users@jersey.java.net

Re:[Jersey] ServletContext

From: Guilhem <guilhem.legal_at_geomatys.fr>
Date: Mon, 28 Jul 2008 16:32:57 +0200

Hi,

I try the following code and i always get a servlet context null, even
after the first request.
Is someone know why?

Guilhem Legal

Tom Deckers (tdeckers) a écrit :
> Thanks Jakub!
>
> Regards,
> Tom.
>
> -----Original Message-----
> From: Jakub.Podlesak_at_Sun.COM [mailto:Jakub.Podlesak_at_Sun.COM]
> Sent: Tuesday, January 08, 2008 15:57
> To: users_at_jersey.dev.java.net
> Cc: Tom Deckers (tdeckers)
> Subject: Re: ServletContext
>
>
> Hi Tom,
>
> you should be able to get it injected
> to your resource:
>
> class A {
>
> @javax.annotation.Resource ServletContext context;
>
> @GET public String getMe() {
> return context.toString();
> }
> }
>
> ~Jakub
>
>
>
> On Tue, Jan 08, 2008 at 02:42:09PM +0100, Tom Deckers (tdeckers) wrote:
>
>> Hi,
>>
>>
>>
>> I can't seem to find a way to access the ServletContext when deploying
>> Jersey in a Tomcat container. I assume this is intentional to hide
>>
> the
>
>> plumbing and since a Servlet container is not required. Is this
>> assumption correct? Any chance access to ServletContext can be
>>
> provided
>
>> when it is available in the application?
>>
>>
>>
>> Thanks!
>> Tom Deckers.
>>
>>
>
>