struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Burgess <RBurg...@nuvox.com>
Subject Re: Best way to access Session with regards to cluster
Date Wed, 30 Apr 2008 20:05:54 GMT
ActionInvocation.getInvocationContext().getSession() or

final HttpServletRequest request = (HttpServletRequest)
context.get(HTTP_REQUEST);
HttpSession session = request.getSession();

will do it in an interceptor. The latter assuming you are implementing
StrutsStatics in the interceptor.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Brad A Cupit <brad@lsu.edu>
> Reply-To: Struts Users Mailing List <user@struts.apache.org>
> Date: Wed, 30 Apr 2008 11:40:49 -0500
> To: Struts Users Mailing List <user@struts.apache.org>
> Subject: RE: Best way to access Session with regards to cluster
> 
>> but I still have some confusion about the proper way to do
>> this so that my session values will be available and
>> replicated properly in a cluster environment.
> 
> The Struts 2 session maps are actually just wrappers around the real
> underlying session. The methods that return (or set) a
> HttpServletRequest should provide the actual http session.
> 
> Basically, once you have setup replicated sessions in your app server,
> Struts 2 should work with it automatically, no matter which method you
> choose to get the session.
> 
> I believe implementing SessionAware is the recommended approach, as it
> doesn't tie your actions to the servlet api (making them more portable
> and easier to test).
> 
> Not sure about getting the session in an interceptor though...
> 
> Brad Cupit
> Louisiana State University - UIS
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



This email and any attachments ("Message") may contain legally privileged and/or confidential
information.  If you are not the addressee, or if this Message has been addressed to you in
error, you are not authorized to read, copy, or distribute it, and we ask that you please
delete it (including all copies) and notify the sender by return email.  Delivery of this
Message to any person other than the intended recipient(s) shall not be deemed a waiver of
confidentiality and/or a privilege.


This email and any attachments ("Message") may contain legally privileged and/or confidential
information.  If you are not the addressee, or if this Message has been addressed to you in
error, you are not authorized to read, copy, or distribute it, and we ask that you please
delete it (including all copies) and notify the sender by return email.  Delivery of this
Message to any person other than the intended recipient(s) shall not be deemed a waiver of
confidentiality and/or a privilege.

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