You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by mohan rao <mo...@gmail.com> on 2011/09/05 09:03:51 UTC

Doubt on Accessing Session from ActionContext

You can obtain the request by asking the ActionContext or implementing
ServletRequestAware. Implementing ServletRequestAwareis preferred. 

*why it's not preferable accessing through ActionContext even though it's
thread safe. If it's true why we need session,request,response,params
interceptors* 

http://struts.apache.org/2.0.11.1/docs/how-can-we-access-the-httpservletrequest.html

--
View this message in context: http://struts.1045723.n5.nabble.com/Doubt-on-Accessing-Session-from-ActionContext-tp4769431p4769431.html
Sent from the Struts - User mailing list archive at Nabble.com.

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


Re: Doubt on Accessing Session from ActionContext

Posted by Chris Pratt <th...@gmail.com>.
Accessing the ActionContext is considered tying youself to a specific
implementation, plus it makes unit testing the Action more involved (since
you have to provide a fully functional ActionContext). Whereas implementing
ServletRequestAware is "programming to interfaces" (which is good practice)
and only requires the injection of necessary Objects by the unit tests.
  (*Chris*)
On Sep 5, 2011 3:11 AM, "mohan rao" <mo...@gmail.com> wrote:
> You can obtain the request by asking the ActionContext or implementing
> ServletRequestAware. Implementing ServletRequestAwareis preferred.
>
> *why it's not preferable accessing through ActionContext even though it's
> thread safe. If it's true why we need session,request,response,params
> interceptors*
>
>
http://struts.apache.org/2.0.11.1/docs/how-can-we-access-the-httpservletrequest.html
>
> --
> View this message in context:
http://struts.1045723.n5.nabble.com/Doubt-on-Accessing-Session-from-ActionContext-tp4769431p4769431.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>