Non-transient request field in FlashScope sometimes prevents serialization for 
session persistence
--------------------------------------------------------------------------------------------------

                 Key: STS-695
                 URL: http://www.stripesframework.org/jira/browse/STS-695
             Project: Stripes
          Issue Type: Bug
          Components: Context Management
    Affects Versions: Release 1.5.1
         Environment: Resin 3.1.9, Java 1.6.0_13, Ubuntu 8.10
            Reporter: Mark Adams


As we know, Stripes' FlashScope objects are stored in a Map in the HttpSession. 
The session attribute that stores them is Serializable, and the FlashScope 
itself implements Serializable, but it has a private field that holds an 
HttpServletRequest, which in practice is an instance of StripesRequestWrapper, 
which is not Serializable, so when you're using persistent sessions and your 
session manager uses serialization, it's possible that you'll end up getting a 
NotSerializableException when attempting to serialize the FlashScope.

The exact behavior probably varies from servlet engine to servlet engine, but 
here's what I've seen with Resin: if the request makes it to the end of 
StripesFilter.doFilter() before trying to save the session, it'll be ok because 
FlashScope.completeRequest() will have been called, which among other things 
nulls out the request field on the FlashScope. However, if an action ends with 
a RedirectResolution, then before the end of doFilter() it will end up in 
RedirectResolution.execute(), which calls HttpResponse.sendRedirect(), which 
(on Resin, at least) saves the session before sending the response to the 
client. At that point, of course, the request field on the FlashScope is still 
non-null, so the serialization fails.

>From the testing I've done so far, it appears that marking the 
>FlashScope.request field as transient will take care of the problem.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to