users@jersey.java.net

[Jersey] Re: Read a file from a Jersey resource deployed on tomcat

From: Monika Solanki <monika.solanki_at_gmail.com>
Date: Mon, 12 Dec 2011 09:35:00 +0000

Hi Pavel,

I am using the Jersey 1.9.1 archive along with the jsr311-api that
comes bundled with it. All the jars are in the path. I create the
Jersey resource and it is a plain Jersey app. When I try to declare the
ServletContext variable, I am told that it is not a valid type. I
thought that ServletContext was a part of jsr311 or am I missing something?

Many Thanks,

Monika


On 12/12/11 09:11, Pavel Bucek wrote:
> Hi Monika,
>
> this doesn't sound right. ServletContext should be injectable - there
> was no change in the API like that.
>
> Which version of Jersey are you using? Who is responsible for creating
> Jersey resource? (Do you have plain Jersey app or are you using spring
> or ejb or something like that?). You can put this declaration into
> your method params and if it won't get injected again, please look
> into server log and share what is in there.
>
> (Or, if you have / can provide reproducible testcase, please do, it
> should be easiest way for us to see what may be wrong).
>
> Regards,
> Pavel
>
> On 12/10/11 7:15 AM, monika.solanki_at_gmail.com wrote:
>> Hello pavel,
>>
>> Unfortunately it does not because I cannot get hold of the
>> ServletContext through the @Context annotation. It seems it may have
>> been possible to do that in the earlier version of the API. Is there
>> any other way to get hold of the ServletContext with Jersey?
>>
>> Many Thanks,
>>
>> Monika
>>
>