I am using session.setAttribute and session.getAttribute but my object
is NOT available in the next request.
also noticed the session.getID() is also different for each request.
my object implements Serializable
code snippet as follows:
public String intercept(ActionInvocation actionInvocation) throws Exception {
// TODO Auto-generated method stub
final ActionContext context =
actionInvocation.getInvocationContext ();
HttpServletRequest request = (HttpServletRequest)
context.get(StrutsStatics.HTTP_REQUEST);
HttpServletResponse response = (HttpServletResponse)
context.get(StrutsStatics.HTTP_RESPONSE);
HttpSession session = request.getSession();
logger.info("session id" + session.getId());
StoreProfile storeProfile = null;
if (session != null) {
storeProfile = (StoreProfile)
session.getAttribute("STOREPROFILE");
}else {
session = request.getSession(true);
logger.info("Creating new session");
}
if (storeProfile == null) {
logger.info("Store Interceptor - First time");
List <Store>StoreList = null;
GaeUser user = null;
user =
(GaeUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
StoreList = storeService.getStores(user.getUserKey().getName());
storeProfile = new StoreProfile();
storeProfile.setStoreList(StoreList);
session.setAttribute("STOREPROFILE", storeProfile);
logger.info("Store Interceptor---" +
storeProfile.getStoreList().size());
}
// now get the StoreProfile from session
//StoreProfile storeProfile = (StoreProfile)
session.getAttribute("STOREPROFILE");
Action action = (Action) actionInvocation.getAction();
// put this object in the action to be used if needed
if (action instanceof IStoreAware) {
((IStoreAware)action).setStoreProfile(storeProfile);
}
return actionInvocation.invoke();
}
}
--
Confidentiality Notice
-------------------------------
THIS INFORMATION IS INTENDED ONLY FOR THE USE OF THE ADDRESSEE AND MAY
CONTAIN INFORMATION THAT IS PRIVILEGED, CONFIDENTIAL AND EXEMPT FROM
DISCLOSURE UNDER APPLICABLE LAW. IF YOU ARE NOT THE INTENDED RECIPIENT, OR
THE EMPLOYEE OR AGENT RESPONSIBLE FOR DELIVERING THIS MESSAGE TO THE
INTENDED RECIPIENT, YOU ARE HEREBY NOTIFIED THAT ANY DISSEMINATION,
DISTRIBUTION OR COPYING OF THE COMMUNICATION IS STRICTLY PROHIBITED. IF YOU
HAVE RECEIVED THIS COMMUNICATION IN ERROR, PLEASE NOTIFY IMMEDIATELY AT
[email protected] OR BY TELEPHONE AT 817-458-1764.
THANK YOU.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.