RE: Injecting in Interceptors (Struts2ejb3)

2009-01-21 Thread Fernandes Celinio SGCF
Hello Lukasz,
Can you access the source code of this plugin ?
http://code.google.com/p/struts2ejb3/

I signed in on google but still cannot see any files.
Is that project still empty ?

Does anyone see the files ?
 
 
-Message d'origine-
De : Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Envoyé : mardi 20 janvier 2009 22:10
À : Struts Users Mailing List
Objet : Re: Injecting in Interceptors

2009/1/20 Ignacio de Córdoba icord...@skios.es:
 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)

Did you try to use that plugin [1], you can ever base on it, build
your own specific solution

[1] http://code.google.com/p/struts2ejb3/


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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

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



Re: Injecting in Interceptors (Struts2ejb3)

2009-01-21 Thread Andras Balogh
Yes, there are 2 files (InjectEJB.java,EJB3Interceptor.java)  that are 
visible at

Browse the Source code
or you can do an anonymous SVN checkout:
svn checkout */http/*://struts2ejb3.googlecode.com/svn/trunk/ 
struts2ejb3-read-only


BR,
Andras

Fernandes Celinio SGCF wrote:

Hello Lukasz,
Can you access the source code of this plugin ?
http://code.google.com/p/struts2ejb3/

I signed in on google but still cannot see any files.
Is that project still empty ?

Does anyone see the files ?
 
 
-Message d'origine-
De : Lukasz Lenart [mailto:lukasz.len...@googlemail.com] 
Envoyé : mardi 20 janvier 2009 22:10

À : Struts Users Mailing List
Objet : Re: Injecting in Interceptors

2009/1/20 Ignacio de Córdoba icord...@skios.es:
  

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)



Did you try to use that plugin [1], you can ever base on it, build
your own specific solution

[1] http://code.google.com/p/struts2ejb3/


Regards
  



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



Injecting in Interceptors

2009-01-20 Thread Ignacio de Córdoba

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



Re: Injecting in Interceptors

2009-01-20 Thread Musachy Barroso
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



Re: Injecting in Interceptors

2009-01-20 Thread Ignacio de Córdoba

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



Re: Injecting in Interceptors

2009-01-20 Thread Musachy Barroso
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



Re: Injecting in Interceptors

2009-01-20 Thread Dave Newton

Ignacio de Córdoba 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.


You don't need to get JNDI resources on every request--use the lazy 
initialization pattern and only get it the first time. Since 
interceptors aren't re-instantiated this should work fine.


Dave


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



Re: Injecting in Interceptors

2009-01-20 Thread Ignacio de Córdoba

Thanks for your reply Dave,
I'll have to solve it that way... but I wanted to use the init() method and
so avoid the if() checking for the EJBS existance... 
Without any info about the environment I don't really get how that method is
useful for anything.

Thanks,
Ignacio



newton.dave wrote:
 
 Ignacio de Córdoba 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.
 
 You don't need to get JNDI resources on every request--use the lazy 
 initialization pattern and only get it the first time. Since 
 interceptors aren't re-instantiated this should work fine.
 
 Dave
 
 
 -
 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-tp21570523p21571306.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



Re: Injecting in Interceptors

2009-01-20 Thread Lukasz Lenart
2009/1/20 Ignacio de Córdoba icord...@skios.es:
 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)

Did you try to use that plugin [1], you can ever base on it, build
your own specific solution

[1] http://code.google.com/p/struts2ejb3/


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



Re: Injecting in Interceptors

2009-01-20 Thread Ignacio de Córdoba

Hi,
I saw that plugin but it solves the application name subdir to be supplied
in the JNDI lookup with a parameter in the Annotation, which makes it code
dependant. I need to get that data from the ServletContext (application
name) or at least a webapp init parameter.
As I see it, the lazy load aproach seems the best for the moment.


Lukasz Lenart wrote:
 
 2009/1/20 Ignacio de Córdoba icord...@skios.es:
 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)
 
 Did you try to use that plugin [1], you can ever base on it, build
 your own specific solution
 
 [1] http://code.google.com/p/struts2ejb3/
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 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-tp21570523p21573532.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