-
Bug
-
Resolution: Fixed
-
Major
-
3.6.1
-
None
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?
- is causing
-
MAGNOLIA-3338 Context is not updated on include request
- Closed
- is depended upon by
-
MAGNOLIA-1455 Remove usage of HttpServletRequest and -Reponse in TemplateRenderer
- Closed
-
MAGNOLIA-2494 Add support for re-execution of filter chain on includes
- Closed
- is related to
-
MAGNOLIA-2472 GZip Filter throws IllegalStateException when performing a redirect
- Closed