Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jersey-dev] upgrading from jersey 1.19 to jersey 2.25.1

Hello,

Thank you for the response. 

Sorry my bad, I provided an incorrect list.
Jersey JARS:
jersey-container-servlet-core.jar
jersey-server.jar
jersey-common.jar
javax.ws.rs-api-2.0.1.jar
hk2-api-2.5.0-b32.jar
jersey-guava-2.25.1.jar
javax.inject-2.5.0-b32.jar
hk2-utils-2.5.0-b32.jar
hk2-locator-2.5.0-b32.jar;
javax.annotation-api-1.2.jar
javassist-3.20.0-GA.jar
jersey-client.jar
validation-api-1.1.0.Final.jar
jersey-entity-filtering-2.25.1.jar
jersey-media-json-jackson-2.25.1.jar

Below is the code :
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.LifeCycle;

public class AdminWebServer extends AbstractLifeCycle
{
   .....
    @Override
    protected void doStart() throws Exception
    {
        .....
            super.doStart();
            loader = new AdminWebServerLifeCycleXmlLoader( getConfig() );
            LifeCycle[] lifeCycles = loader.getLifeCycles();
            if( lifeCycles != null && lifeCycles.length > 0 )
            {
                for( LifeCycle lifeCycle : lifeCycles )
                {
                    if( lifeCycle instanceof Server )
                    {
                        ServletContextHandler context = new ServletContextHandler( ServletContextHandler.SESSIONS );
                        context.setContextPath( "/" );
                        ( (Server) lifeCycle ).setHandler( context );

                        ServletHolder jerseyServlet = context.addServlet( org.glassfish.jersey.servlet.ServletContainer.class, "/api/*" );
                        jerseyServlet.setInitOrder( 1 );
                        jerseyServlet.setInitParameter( "jersey.config.server.provider.packages", "com.web.webapi" );

                        // add security filter
                        jerseyServlet.setInitParameter( "jersey.config.server.provider.classnames", SecurityFilter.class.getName() );

                        // static content/ui artifacts served from the /static directory
                        ServletHolder staticServlet = context.addServlet( DefaultServlet.class, "/*" );
                        staticServlet.setInitParameter( "resourceBase", "./static/" );
                        staticServlet.setInitParameter( "pathInfoOnly", "true" );
                        staticServlet.setInitParameter( "dirAllowed", "false" );
                    }
                }
            }
            loader.start();
        ....
    }
...
}

It's more of a confusion for me rather than a question, As you see I did not pull in 'jersey-container-jetty-http' and the application ( jersey + embedded jetty) started up fine. Why would I need this jar ? If I add dependency to 'jersey-container-jetty-http', what changes would I need to do codewise ? 

Thanks again ..


On Thu, Jun 11, 2020 at 3:07 AM Jan Supol <jan.supol@xxxxxxxxxx> wrote:
Hi Usha,

jersey-container-jetty-http provides a way to start an embedded Jetty
that the Jersey runs in. You say you have pulled
jersey-container-jetty-http-2.25.1.jar already and it runs fine.

So what is your question?

Thanks,

Jan

On 11.06.2020 0:22, Usha Nayak wrote:
> Hello
>
> We have REST application with Jersey and embedded jetty and in process
> of upgrading jersey to 2.25.1
>
> I found I had to pull in the highlighted dependencies ( without maven
> ) during upgrade to jersey 2.25.1 ( the rest of them were already in
> the project ).
> Jersey:
>
>     jersey-container-servlet-core.jar
>     jersey-server.jar
>     jersey-common.jar
>     javax.ws.rs-api-2.0.1.jar
>     jersey-container-jetty-http-2.25.1.jar
>     hk2-api-2.5.0-b32.jar
>     jersey-guava-2.25.1.jar
>     javax.inject-2.5.0-b32.jar
>     hk2-utils-2.5.0-b32.jar
>     hk2-locator-2.5.0-b32.jar;
>     javax.annotation-api-1.2.jar
>     javassist-3.20.0-GA.jar
>     jersey-client.jar
>     validation-api-1.1.0.Final.jar
>
> Jackson :
>
>     jackson-annotations-2.10.2.jar
>     jackson-core-2.10.2.jar
>     jackson-databind-2.10.2.jar
>     jackson-jaxrs-base-2.10.2.jar
>     jackson-jaxrs-json-provider-2.10.2.jar
>     jackson-module-jaxb-annotations-2.10.2.jar
>
> Jetty JARS:
>
>     jetty-continuation-9.4.26.v20200117.jar
>     jetty-http-9.4.26.v20200117.jar
>     jetty-io-9.4.26.v20200117.jar
>     jetty-jmx-9.4.26.v20200117.jar
>     jetty-security-9.4.26.v20200117.jar
>     jetty-server-9.4.26.v20200117.jar
>     jetty-servlet-9.4.26.v20200117.jar
>     jetty-servlets-9.4.26.v20200117.jar
>     jetty-util-9.4.26.v20200117.jar
>     servlet-api-3.1.jar
>     jetty-xml-9.4.26.v20200117.jar
>
>
> On googling though, I found many sites where their application was
> jersey + embedded jetty based where they had dependency to following
> jersey components ( but then again they were using maven as well ) :
>
>     jersey-container-jetty-http
>     jersey-container-servlet-core
>     jersey-server.jar
>
>
> With current jars in the classpath, I was able to compile and run our
> application ok. However, I'm a bit confused about '
> jersey-container-jetty-http'. Do I need this as well ? Does the list
> of dependent jars look complete ? I ahevt o admit I wasn't expecting
> so many jars after working with a single bundle in jersey 1.1.9
> Any help would be greatly appreciated.
>
> Thanks..
>
>
>
> _______________________________________________
> jersey-dev mailing list
> jersey-dev@xxxxxxxxxxx
> To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jersey-dev
_______________________________________________
jersey-dev mailing list
jersey-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jersey-dev

Back to the top