users@jersey.java.net

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

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Mon, 12 Dec 2011 10:11:43 +0100

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
>