users@jersey.java.net

[Jersey] Re: Init-params for Jersey 2.0 vs jersey 1.17 in web.xml

From: Matthieu Heimer <matt.heimer_at_osdev.org>
Date: Thu, 29 Aug 2013 10:35:45 -0500

The other init-params are for filters which are now part of the JAX-RS
2.0 API. Look at section 6.5 of JSR 339. You should be able to return
your filters from your Application sub-class methods such as
getClasses or getSingletons. You can also group them together using a
Feature and return that from your Application sub-class.

On Tue, Aug 27, 2013 at 12:54 PM, Surya De <suryade_at_gmail.com> wrote:
> Hello all,
>
> I am wondering if you could point me in the right direction. I am trying to
> upgrade to the latest Jersey 2.2 from 1.17 and am currently facing a problem
> when it comes to the web.xml.
>
> Previously we would have our web.xml section that is initializing the
> servlet look like so:
> <servlet>
> <servlet-name>Jersey REST Service</servlet-name>
>
> <servlet-class>com.sun.jersey.spi.spring.container.servlet.SpringServlet</servlet-class>
> <init-param>
> <param-name>com.sun.jersey.config.property.packages</param-name>
> <param-value>com.some.package</param-value>
> </init-param>
> <init-param>
>
> <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
> <param-value>com.some.package.SomeFilter</param-value>
> </init-param>
> <init-param>
> <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
> <param-value>com.some.package.AnotherFilter</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
> Now I have changed it to look like so:
> <servlet>
> <servlet-name>Jersey REST Service</servlet-name>
>
> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
> <init-param>
> <param-name>jersey.config.server.provider.packages</param-name>
> <param-value>com.turner.ids</param-value>
> </init-param>
> <init-param>
>
> <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
> <param-value>com.some.package.SomeFilter</param-value>
> </init-param>
> <init-param>
> <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name>
> <param-value>com.some.package.AnotherFilter</param-value>
> </init-param>
> <load-on-startup>1</load-on-startup>
> </servlet>
>
>
> You will note that the servlet-class and the first init-param have changed
> but I am not sure how I would go ahead and map the other init-params. Any
> guidance would be much appreciated.
>
> Cheers,
> Surya