UnicodeNormalizationFilter seems to be messing up the virtualUriMappings
------------------------------------------------------------------------

                 Key: MAGNOLIA-3310
                 URL: http://jira.magnolia-cms.com/browse/MAGNOLIA-3310
             Project: Magnolia
          Issue Type: Bug
          Components: core
    Affects Versions: 4.3.6
            Reporter: Ernst Bunders
            Assignee: Philipp Bärfuss


Hello

I discovered a problem with a virtual uri mapping (of type forward)and the 
UnicodeNormalizationFilter. What i try to do is the following:
I have a processed css file that creates the css for a configurable theme. The 
theme also has a dialog that lets you do all kinds of theme settings.
The theme css is called with some parameters: the uuid of the page node (to 
resolve the theme config), and a version parameter (to create uniuque urls for 
each 'version' of the theme).

What i want is a virtalUriMapping for this css request, so i can call it 
without request parameters, making it more cachable. Here is the 
virtualUriMapping config:
class:         info.magnolia.cms.beans.config.RegexpVirtualURIMapping
fromURI:      ^/themes/([^/]+)/([0-9]+)/theme\.css$
toURI:          
forward:/resources/vpro/themes/pip/css/theme.css?uuid=$1&lastmodified=$2

this way i can call my css from the template like: 
http://localhost:8080/pip/themes/1fb8d8e1-d625-4c24-95a3-904e0102eddd/1286288160080/theme.css
And the request is forwarded to: 
/resources/vpro/themes/pip/css/theme.css?uuid=1fb8d8e1-d625-4c24-95a3-904e0102eddd&lastmodified=1286288160080

So that works but oh lala: when the css model class kicks into action: no more 
request parameters.
I put some breakpoints here and there and this is what i see:

- Every request object is wrapped with a 
info.magnolia.cms.filters.UnicodeNormalizationFilter.UnicodeNormalizerRequestWrapper
 by the UnicodeNormalizationFilter filter.
- this method has a method getParameterMap(), that will look into the wrapped 
request and fetch the parameters only once.
- so the first time the VirtualUriFilter is hit, the request wrapper is 
wrapping a request with no parameters. So the 
UnicodeNormalizerRequestWrapper.parameters map is empty.
- The virtualUriMapping is found, the 'forward:' prefix is found, and a request 
dispatcher is created (with proper requestUri and queryString values).
- the request is forwarded.
- At this point i would expect a new request to be created and reinserted into 
the whole requests handling pipeline. So the next time 
UnicodeNormalizationFilter is hit, i expect the request to be unwrapped. To my 
surprise this is not the case. the request is wrapped already, and the wrapper 
still has the parameters map (with zero entries)  from the first request.
The wrapper now wraps two requests! In it's field 'original' there is the 
request with url:  
http://localhost:8080/pip/themes/1fb8d8e1-d625-4c24-95a3-904e0102eddd/1286288160080/theme.css
 (the first request), and in it's field 'request' (inherited from 
HttpServletRequestWrapper) a request with url: 
/resources/vpro/themes/pip/css/theme.css and queryString: 
uuid=1fb8d8e1-d625-4c24-95a3-904e0102eddd&lastmodified=1286288160080 ( the new 
request)

All a bit surprising, and It seems to me that the wrapper is still around at 
the second request handling. Another thing that seems strange: why does the 
UnicodeNormalizerRequestWrapper has it's own field for the wrapped request and 
parameters, as it already extends HttpServletRequestWrapper. It seems to me 
that the only method that actually adds someting is getHeader(String name).

And thus: when i switch of the UnicodeNormalization filter: it works!

-- 
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/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to