You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dave Newton <DN...@hibbertgroup.com> on 2007/01/23 14:52:57 UTC

[s2] Question about SessionAware docs.

The JavaDoc for SessionAware states:

"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."

I'm not entirely sure that's accurate, as it isn't *explicitly* tied to
the servlet environment... it's just that S2 uses an interceptor (I
assume) to copy over HttpSession attributes. But it's just a Map setter.

Could the wording be changed a little bit?

Dave


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


Re: [s2] Question about SessionAware docs.

Posted by Tom Schneider <sc...@gmail.com>.
Actually your explanation is not quite 100% correct.  The interceptor
injects a Map that is backed by the HttpSession.  So puts and gets to the
Map will actually be puts and gets to the HttpSession.  (Very clever IMO)

You have a valid point about the javadoc.  My guess is that at one point it
actually did set a HttpSession on the action, but later was changed to be a
Map and the javadoc was never updated.
Tom

On 1/23/07, Dave Newton <DN...@hibbertgroup.com> wrote:
>
> The JavaDoc for SessionAware states:
>
> "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."
>
> I'm not entirely sure that's accurate, as it isn't *explicitly* tied to
> the servlet environment... it's just that S2 uses an interceptor (I
> assume) to copy over HttpSession attributes. But it's just a Map setter.
>
> Could the wording be changed a little bit?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>