Guilhem wrote:
> Hi,
>
> I try the following code and i always get a servlet context null, even
> after the first request.
> Is someone know why?
>
The API has changed: use the @Context annotation instead:
class A {
@Context ServletContext context;
@GET public String getMe() {
return context.toString();
}
}
Paul.
> 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.
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
--
| ? + ? = To question
----------------\
Paul Sandoz
x38109
+33-4-76188109