agr, that's true, it won't be available on the init method.

On Tue, Jan 20, 2009 at 3:31 PM, Ignacio de Córdoba <icord...@skios.es> wrote:
>
> Hi Musachy and thanks for your reply but that static invocation in that class
> is not working if called from an interceptor or, at least, from the init()
> method of the interceptor.
>
> Probably this is due to the way it gets the ServletContext. Probably it
> first gets the request or the session, and uses current thread for that. As
> in the init() method there is no Action (remember Interceptors are not
> binded to an action or request, but instanciated only once at the web
> application deployment) there is no request/response/session, and so I
> returns "null". No ServletContext. :-(
>
> Any other ideas? :-)
>
> Thanks,
> Ignacio
>
>
> Musachy Barroso wrote:
>>
>> org.apache.struts2.ServletActionContext.getServletContext() is what you
>> want.
>>
>> musachy
>>
>> On Tue, Jan 20, 2009 at 3:03 PM, Ignacio de Córdoba <icord...@skios.es>
>> wrote:
>>>
>>> Hi there,
>>> I am developing a Authorization interceptor and need to perform a JNDI
>>> lookup to get some Stateless EJBs from JBoss.
>>>
>>> My problem is that this interceptor init() method gets no parameters. I
>>> need
>>> to get at least the ServletContext of the web application to specify the
>>> main JNDI lookup name. (EJBs might be deployed in different JNDIs dirs
>>> depending on which application I deploy them).
>>>
>>> Anybody has an idea on how can I get info about ServletContext in the
>>> init()
>>> method of an interceptor? I'd like to lookup EJBs there and not lookup
>>> them
>>> for every request (I know I can get the info I need from ActionInvocation
>>> object that every intercept() gets)
>>>
>>> I'm using Struts 2.1
>>>
>>> Thanks for any ideas,
>>> Ignacio
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Injecting-in-Interceptors-tp21570523p21570523.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Injecting-in-Interceptors-tp21570523p21571037.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to