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:39:27 UTC

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

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.


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

Posted by "Vidar S. Ramdal (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Justin Edelson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Edelson updated SLING-1455:
----------------------------------

    Fix Version/s:     (was: JCR Resource 2.0.8)

descheduling from current release

> 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
>         Attachments: content.xml, etc.xml
>
>
> 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.


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

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12898094#action_12898094 ] 

Felix Meschberger commented on SLING-1455:
------------------------------------------

Since SLING-1218 we are using a copy of the HTTP Client URI class in the JCRResourceResolver to work around escaping issues in the mapped paths. Maybe we could "hack" this class up to account for bracket indices ??

> 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
>
>         Attachments: content.xml, etc.xml
>
>
> 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.


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

Posted by "Vidar S. Ramdal (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-1455?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Vidar S. Ramdal updated SLING-1455:
-----------------------------------

    Attachment: content.xml
                etc.xml

Repository content as described, for reproducing the error

> 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
>
>         Attachments: content.xml, etc.xml
>
>
> 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.