dev@jersey.java.net

Re: _at_Context ServletConfig in Tomcat 6

From: Wolf, Timo <timowolf_at_siemens.com>
Date: Mon, 22 Nov 2010 13:47:51 +0100

Hi,

thanks a lot. Such an important little detail.

Now it wok in Tomcat and in the jesey tests.

Thanks a lot.

Best, Timo





On 22.11.2010, at 13:29, Paul Sandoz wrote:

> Hi,
>
> Because you are using a filter you need to inject FilterConfig, or see
> later.
>
> ServletConfig is only available when deploying as a servlet.
> FilterConfig is only available when deploying as a filter.
>
> Unfortunately the servlet API does not abstract such configuration,
> but Jersey does. So you can inject:
>
> com.sun.jersey.spi.container.servlet.WebConfig
>
> Paul.
>
> On Nov 22, 2010, at 1:24 PM, Wolf, Timo wrote:
>
>> Hi Paul,
>>
>> thanks for the fast response. I am using a filter:
>>
>> <filter>
>> <filter-name>Jersey Filter</filter-name>
>> <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</
>> filter-class>
>> <init-param>
>> <param-name>com.sun.jersey.config.feature.Redirect</param-name>
>> <param-value>true</param-value>
>> </init-param>
>> <init-param>
>> <param-name>com.sun.jersey.config.feature.ImplicitViewables</param-
>> name>
>> <param-value>true</param-value>
>> </init-param>
>> <init-param>
>> <param-name>javax.ws.rs.Application</param-name>
>> <param-value>com....Application</param-value>
>> </init-param>
>> <init-param>
>> <param-name>com.sun.jersey.config.property.WebPageContentRegex</
>> param-name>
>> <param-value>(/images/.*|/oauth/.*|.+\.jsp|.+\.css)</param-value>
>> </init-param>
>> </filter>
>>
>> Thanks Timo.
>>
>> On 22.11.2010, at 13:19, Paul Sandoz wrote:
>>
>> Hi Timo,
>>
>> I just did a quick test with GlassFish and it works fine for me.
>>
>> Are you deploying Jersey as a servlet or a filter?
>>
>> Paul.
>>
>> On Nov 22, 2010, at 12:43 PM, Wolf, Timo wrote:
>>
>> Hi,
>> I am using jersey 1.4 and extend the Application class to provide a
>> Web-Application. To access the Servlet Configuration I am using a
>> @Context ServletConfig sc property. Everything works fine when
>> testing with com.sun.jersey.jersey-test-framework and grizzly web
>> server.
>>
>> But when building the war file and deploying to Tomcat 6 I got the
>> following problem:
>>
>> Nov 22, 2010 11:41:56 AM com.sun.jersey.spi.inject.Errors
>> processErrorMessages
>> SEVERE: The following errors and warnings have been detected with
>> resource and/or provider classes:
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> com....Application.sc
>>
>> Any ideas what might be wrong or missing in my maven dependency
>> configuration?
>>
>> Thanks a lot!
>>
>> Best, Timo
>>
>>
>