struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Pratt <thechrispr...@gmail.com>
Subject Re: Doubt on Accessing Session from ActionContext
Date Mon, 05 Sep 2011 12:27:51 GMT
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" <mohanaraosv@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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message