Tim Koopman created WICKET-5844:
-----------------------------------

             Summary: CryptoMapper doesn't work with context relative 
UrlResourceReferences
                 Key: WICKET-5844
                 URL: https://issues.apache.org/jira/browse/WICKET-5844
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.19.0
            Reporter: Tim Koopman


Adding a CryptoMapper to the application causes context relative URL's to be 
rendered twice, causing them to stop working.

For example a webjar resource is rendered as:

||page||rendered url||
|/|./webjars/jquery/1.11.2/jquery.js|
|/admin|./webjars/jquery/1.11.2/jquery.js|
|/admin/configuration|../../webjars/jquery/1.11.2/jquery.js|
|/admin/configuration/|../../../../webjars/jquery/1.11.2/jquery.js|

The last two urls won't work as they point to urls outside the context root.

The reason this happens is because UrlResourceReference#getUrl returns a 
UrlResourceReference$CalculatedUrl, which is normally skipped by 
UrlRenderer#renderRelativeUrl.
But in the case of CryptoMapper, this CalculatedUrl is converted to a normal 
Url (in CryptoMapper#encryptRequestListenerParameter) which isn't skipped.

So, when you have a CryptoMapper all context relative urls are converted twice: 
once by UrlRenderer#renderContextRelativeUrl and again by 
UrlRenderer#renderRelativeUrl.

A quick fix would be to ignore all url's of type IUrlRenderer in CrytoMapper's 
mapHandler, but I don't know it this the wanted solution. It seems pretty weird 
to me that conversion is done twice at all.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to