I have no constraints against using the ApplicationContextAware ([1])
interface. But I am not quite understanding how to use that interface in
my scenario which is as follows:
I would be grateful if you can give a little more hint on how to solve
this problem. Thanks.
On 10/17/2011 08:03 AM, Jakub Podlesak wrote:
> Hi Farrukh,
>
> Any chance you could utilize Spring means to get the actual application
> context reference? I mean e.g. implementing ApplicationContextAware
> ([1]) interface?
>
> ~Jakub
>
> [1]http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/context/ApplicationContextAware.html >
>
>
> On 13.10.2011 17:47, Farrukh Najmi wrote:
>>
>> I am working on a java class that needs to expose a jersey server
>> endpoint for receiving callbacks from an external process. The class
>> needs to be usable in a standalone java app. I am therefor using an
>> embedded Grizzly HttpServer created using
>> com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory. I am
>> using com.sun.jersey.spi.spring.container.servlet.SpringServlet to
>> deploy my spring wired jersey server into the Grizzly HttpServer.
>>
>> Is there a way to get access to spring application context created by
>> the SpringServlet (and beans it creates) from the container code that
>> creates the SpringServlet and Grizzly HttpServer after it starts the
>> Grizzly HttpServer?
>>
>> I see that com.sun.jersey.spi.spring.container.servlet.SpringServlet
>> has protected methods |*getDefaultContext
>> <http://jersey.java.net/nonav/apidocs/1.9.1/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/SpringServlet.html#getDefaultContext%28%29>*()|and
>> |*getChildContext
>> <http://jersey.java.net/nonav/apidocs/1.9.1/contribs/jersey-spring/com/sun/jersey/spi/spring/container/servlet/SpringServlet.html#getChildContext%28java.lang.String%29>*|(java.lang.String contextConfigLocation).
>> Is there a reason these are protected and not public?
>>
>> Right now I would have to derive a sub-class from SprinServlet and
>> make these methods public. Is there a better way?
>> Also should I file an RFE to make these methods public?
>>
>> --
>> Regards,
>> Farrukh Najmi
>>
>> Web:http://www.wellfleetsoftware.com >>