You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Vidar S. Ramdal (JIRA)" <ji...@apache.org> on 2010/03/22 00:53:27 UTC

[jira] Commented: (SLING-1455) Impossible to refer to same-name-siblings when doing internal redirect to another protocol

    [ https://issues.apache.org/jira/browse/SLING-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12848009#action_12848009 ] 

Vidar S. Ramdal commented on SLING-1455:
----------------------------------------

A quick fix is to "manually" escape the brackets characters.
JcrResourceResolver#213, current version:
URI uri = new URI(mappedPath[0], false);

Fixed version:
URI uri = new URI(mappedPath[0].replaceAll("\\[(\\d*)\\]", "%5B$1%5D"), false);

However, this fixes only the case with brackets. There might be other characters that need escaping, too, which I haven't yet run into.


> Impossible to refer to same-name-siblings when doing internal redirect to another protocol
> ------------------------------------------------------------------------------------------
>
>                 Key: SLING-1455
>                 URL: https://issues.apache.org/jira/browse/SLING-1455
>             Project: Sling
>          Issue Type: Bug
>          Components: JCR
>    Affects Versions: JCR Resource 2.0.6
>            Reporter: Vidar S. Ramdal
>             Fix For: JCR Resource 2.0.8
>
>
> Consider the following repository contents:
> /etc/map/general-redirect
> - sling:internalRedirect = protocol://$1
> - sling:match = http/(.*)\.\d+
> /etc/map/protocol
> - sling:internalRedirect = /content
> /content/localhost.80
> /content/localhost.80/child
> /content/localhost.80/child[2]
> The domain mappings (under /etc/map) are then set up so that:
> 1) A request to http://localhost:8080 should internally redirect to protocol://localhost.80. This, again, causes the request to resolve to /content/localhost.80, which is what is intended.
> 2) Thus, a request to http://localhost:8080/child.html should resolve to /content/localhost.80/child.
> Both 1) and 2) works as intended. However, when including indexes for same-name siblings, the resolution fails:
> http://localhost:8080/child[2].html
> .. causes a NPE: *ERROR* [0:0:0:0:0:0:0:1%0 [1269213415402] GET /child%5B2%5D.html HTTP/1.1] org.apache.sling.engine.impl.SlingMainServlet service: Uncaught Problem handling the request java.lang.NullPointerException
> 	at org.apache.sling.engine.impl.SlingHttpServletRequestImpl.getResource(SlingHttpServletRequestImpl.java:90)
> 	at org.apache.sling.servlets.resolver.internal.SlingServletResolver.getErrorResource(SlingServletResolver.java:368)
> 	at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:259)
> This is because resolution in JcrResourceResolver has failed when trying to construct a URL for the string protocol://localhost/child[2].html:
>             try {
>                 URI uri = new URI(mappedPath[0]);
> ... throws a URISyntaxException because the string argument contains unescaped brackets (for [2]). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.