A way to prevent "Cannot create a session after the response has been committed"
--------------------------------------------------------------------------------

                 Key: MAGNOLIA-3984
                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3984
             Project: Magnolia
          Issue Type: Improvement
      Security Level: Public
          Components: core
    Affects Versions: 4.4.5
         Environment: JBoss 5.1 EAP, Oracle 10, Google Chrome 17.0.963.56, 
Firefox 10.0.1, Ubuntu 11.10
            Reporter: Per Andersson
            Assignee: Philipp Bärfuss


Hi,

Me and my team noticed a very interesting behavior for one of our Spring 
Webflow components. For some of our browsers it generated the exception: 
"java.lang.IllegalStateException: Cannot create a session after the response 
has been committed". This seems to be because the template html is being 
written to the request output stream before any of our components. When 
Magnolia iterates and executes our Spring Webflow component it tries to create 
a session, which by then is too late because data is already being written to 
the output stream. Although this is only a problem if the end-users browser 
doesn't support G-Zip and if the cache filter is disabled for a specific path. 
The supplied browser versions (and OS version) I've supplied above seems to not 
accept G-zip content which is why I notice this behavior on my computer. 

So my proposal is this: Is it possible for you to use a separate OutputStream 
instance and then write to the real OutputStream when the entire template/page 
is rendered? We are adding "<#assign session = ${ctx.request.session} />" at 
the top of the freemarker template file as a workaround at the moment.

Used this forum-post as a reference: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=5e34ed28-5269-4333-9e9d-a30aca8a95e3

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

       


----------------------------------------------------------------
For list details, see: http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to