Re: SessionAware vs ActionContext access to session - confused..
In the next release, there will be *Aware interfaces for the portlet objects. Nils-H On 9/13/07, tom tom [EMAIL PROTECTED] wrote: Yes in theory you are correct, but in side a S2 portlet (which implements ServletRequestAware interface) if you try to get a handler for HttpServletRequest object via the setServletRequest method it basically gives null. How we make a handler for the HttpServletRequest object is as follows, PortletRequest portletRequest =PortletActionContext.getRequest(); request = (HttpServletRequest) portletRequest; there were lot of other things we had to do differently, but for all we got some solution. I thing this is a seperate discussion alltogether why it doesnt work like a web application etc? hope this helps --- Chris Pratt [EMAIL PROTECTED] wrote: On 9/12/07, tom tom [EMAIL PROTECTED] wrote: If you are developing portlets with struts2 I doubt *Aware interfaces work properly, you have to do it differently. I don't know of anything that would preclude you (or anyone else) from writing a set of Portlet aware Interceptors. They could even use the same *Aware interfaces. The advantage is that you could use the same actions whether or not they were in a Portlet by just changing the Interceptor Stack. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
Thats sounds good, also try to have model-driven interfaces to have the session scope Action forms in the next release, that also not working currently. Also in the s:url the action tag does not evaluate expressions, e.g if you want to have a dynamic action name. Pls try to address that as well. Thanks --- Nils-Helge Garli [EMAIL PROTECTED] wrote: In the next release, there will be *Aware interfaces for the portlet objects. Nils-H On 9/13/07, tom tom [EMAIL PROTECTED] wrote: Yes in theory you are correct, but in side a S2 portlet (which implements ServletRequestAware interface) if you try to get a handler for HttpServletRequest object via the setServletRequest method it basically gives null. How we make a handler for the HttpServletRequest object is as follows, PortletRequest portletRequest =PortletActionContext.getRequest(); request = (HttpServletRequest) portletRequest; there were lot of other things we had to do differently, but for all we got some solution. I thing this is a seperate discussion alltogether why it doesnt work like a web application etc? hope this helps --- Chris Pratt [EMAIL PROTECTED] wrote: On 9/12/07, tom tom [EMAIL PROTECTED] wrote: If you are developing portlets with struts2 I doubt *Aware interfaces work properly, you have to do it differently. I don't know of anything that would preclude you (or anyone else) from writing a set of Portlet aware Interceptors. They could even use the same *Aware interfaces. The advantage is that you could use the same actions whether or not they were in a Portlet by just changing the Interceptor Stack. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! oneSearch: Finally, mobile search that gives answers, not web links. http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
On Tuesday 11 September 2007 23:03, Nils-Helge Garli wrote: You could, but I would recommend using the *Aware interfaces in your actions. It makes them easier to test. Hmm.. I've always handled session data by creating an application base action that implements a getUserData() and a setUserData() method. All my actions extend this base action. I then use an interceptor to grab the session data build whatever object I decide to use to hold the data and inject it into the base action. In this way, all my actions can simply getUserData() without having to care where the data comes from. Is this bad practice or just a matter of personal preference? Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
Hi, If you are developing portlets with struts2 I doubt *Aware interfaces work properly, you have to do it differently. For example How we get a handler for Http request or session is not via *Aware interfaces for portlets. --- j alex [EMAIL PROTECTED] wrote: Hi, In the Struts 2 docs, it's recommended to implement SessionAware for accessing session within Action, but looking at some Webwork documentation, http://wiki.opensymphony.com/display/WW1/SessionAware+Actions - it seems to convey the opposite message . Please clarify : 1. Why accessing via ActionContext is not advisable ? 2. In SessionAware API doc it's said Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult. -- how is it tied to servlet env, since we are not having any HTTP-specific code in the Action but just a plain setSession(Map map) method? Thanks, Joseph Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
Hmm.. I've always handled session data by creating an application base action that implements a getUserData() and a setUserData() method. All my actions extend this base action. I then use an interceptor to grab the session data build whatever object I decide to use to hold the data and inject it into the base action. In this way, all my actions can simply getUserData() without having to care where the data comes from. Is this bad practice or just a matter of personal preference? I hope it's not a bad idea, I do the exact same thing with my User =8^) But there are commonly other things stored in the session that you might need access to and, depending on the app, writing an Interceptor for each of them might be a bit much. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
Yes in theory you are correct, but in side a S2 portlet (which implements ServletRequestAware interface) if you try to get a handler for HttpServletRequest object via the setServletRequest method it basically gives null. How we make a handler for the HttpServletRequest object is as follows, PortletRequest portletRequest =PortletActionContext.getRequest(); request = (HttpServletRequest) portletRequest; there were lot of other things we had to do differently, but for all we got some solution. I thing this is a seperate discussion alltogether why it doesnt work like a web application etc? hope this helps --- Chris Pratt [EMAIL PROTECTED] wrote: On 9/12/07, tom tom [EMAIL PROTECTED] wrote: If you are developing portlets with struts2 I doubt *Aware interfaces work properly, you have to do it differently. I don't know of anything that would preclude you (or anyone else) from writing a set of Portlet aware Interceptors. They could even use the same *Aware interfaces. The advantage is that you could use the same actions whether or not they were in a Portlet by just changing the Interceptor Stack. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SessionAware vs ActionContext access to session - confused..
Hi, In the Struts 2 docs, it's recommended to implement SessionAware for accessing session within Action, but looking at some Webwork documentation, http://wiki.opensymphony.com/display/WW1/SessionAware+Actions - it seems to convey the opposite message . Please clarify : 1. Why accessing via ActionContext is not advisable ? 2. In SessionAware API doc it's said Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult. -- how is it tied to servlet env, since we are not having any HTTP-specific code in the Action but just a plain setSession(Map map) method? Thanks, Joseph
Re: SessionAware vs ActionContext access to session - confused..
Basically, for Actions you should use SessionAware (since you don't have access to the ActionContext from within a standard Action). But if you are writing an Interceptor, you would use ActionContext to get access to the Session data. (*Chris*) On 9/11/07, j alex [EMAIL PROTECTED] wrote: Hi, In the Struts 2 docs, it's recommended to implement SessionAware for accessing session within Action, but looking at some Webwork documentation, http://wiki.opensymphony.com/display/WW1/SessionAware+Actions - it seems to convey the opposite message . Please clarify : 1. Why accessing via ActionContext is not advisable ? 2. In SessionAware API doc it's said Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult. -- how is it tied to servlet env, since we are not having any HTTP-specific code in the Action but just a plain setSession(Map map) method? Thanks, Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
I can do Map attibutes = ActionContext.getContext().getSession(); from an Action - right? On 9/11/07, Chris Pratt [EMAIL PROTECTED] wrote: Basically, for Actions you should use SessionAware (since you don't have access to the ActionContext from within a standard Action). But if you are writing an Interceptor, you would use ActionContext to get access to the Session data. (*Chris*) On 9/11/07, j alex [EMAIL PROTECTED] wrote: Hi, In the Struts 2 docs, it's recommended to implement SessionAware for accessing session within Action, but looking at some Webwork documentation, http://wiki.opensymphony.com/display/WW1/SessionAware+Actions - it seems to convey the opposite message . Please clarify : 1. Why accessing via ActionContext is not advisable ? 2. In SessionAware API doc it's said Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult. -- how is it tied to servlet env, since we are not having any HTTP-specific code in the Action but just a plain setSession(Map map) method? Thanks, Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
You could, but I would recommend using the *Aware interfaces in your actions. It makes them easier to test. Nils-H On 9/11/07, j alex [EMAIL PROTECTED] wrote: I can do Map attibutes = ActionContext.getContext().getSession(); from an Action - right? On 9/11/07, Chris Pratt [EMAIL PROTECTED] wrote: Basically, for Actions you should use SessionAware (since you don't have access to the ActionContext from within a standard Action). But if you are writing an Interceptor, you would use ActionContext to get access to the Session data. (*Chris*) On 9/11/07, j alex [EMAIL PROTECTED] wrote: Hi, In the Struts 2 docs, it's recommended to implement SessionAware for accessing session within Action, but looking at some Webwork documentation, http://wiki.opensymphony.com/display/WW1/SessionAware+Actions - it seems to convey the opposite message . Please clarify : 1. Why accessing via ActionContext is not advisable ? 2. In SessionAware API doc it's said Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult. -- how is it tied to servlet env, since we are not having any HTTP-specific code in the Action but just a plain setSession(Map map) method? Thanks, Joseph - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SessionAware vs ActionContext access to session - confused..
On 9/11/07, j alex [EMAIL PROTECTED] wrote: I can do Map attibutes = ActionContext.getContext().getSession(); from an Action - right? Wow, I guess you can. I've never ever needed to access the ActionContext from an Action, so I never even noticed it was possible. Pretty sure I'll stick with Dependency Injection and the *Aware interfaces myself though. (*Chris*) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]