Request stored in WebContext is not updated after a forward
-----------------------------------------------------------

                 Key: MAGNOLIA-2387
                 URL: http://jira.magnolia.info/browse/MAGNOLIA-2387
             Project: Magnolia
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.1
            Reporter: Fabrizio Giustina
            Assignee: Fabrizio Giustina
             Fix For: 3.6.2


The request stored in WebContext by the ContextFilter is never updated, and may 
miss parameters added by a forward.

For example, using a virtualUri filter in order to forward from 
/test/param.html to test..html?x=param I get different results when I do:
request.getParam("x")  --> "param"
((WebContext) MgnlContext.getInstance()).getRequest().getParam("x") --> null

this also means that paragraphs never see parameters added by a forward, since 
the paragraph renderer gets the request from the context. Looks like a 
regression from 3.5, since I was using this kind of forwards and they stopped 
working after upgrading to 3.6 (not sure about which change in the filters has 
caused this).

I would propose to fix it by updating the request stored in WebContext any time 
ContextFilter processes the request. A good fix, without modifying in any way 
the WebContext interface, is doing something like the following:


        if (!MgnlContext.hasInstance() || MgnlContext.isSystemInstance())
        {
            MgnlContext.initAsWebContext(request, response, servletContext);
            contextSet = true;
        }
+        else
+        {
+            // update request
+            WebContext webContext = (WebContext) MgnlContext.getInstance();
+            webContext.init(request, response, servletContext);
+        }
+

I would like to commit this to 3.6.2, this can be a very annoying bug for 
anyone using forwards with parameters. Any objection? 




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

        

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/
----------------------------------------------------------------

Reply via email to