[ 
https://issues.apache.org/jira/browse/SLING-9508?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hans-Peter Stoerr updated SLING-9508:
-------------------------------------
    Description: 
I'm not sure whether the documentation or the implementation is wrong here, but 
 
[https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html#overview]
 says:
{quote}For existing resources the resource path is the longest match (also 
considering its 
[mappings|https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html])
 pointing to a resource where the next character is either a dot ({{.}}) or it 
is the full request URI. Otherwise (for a path not matching any existing 
resource) the resource path ends at the _first dot ({{.}})_ in the request url.
{quote}
But when resolving a not existing resource containing a dot, e.g. 
"/unknown/url.txt/suffix" , I surprisingly get a NonExistingResource 
"/unknown/url.txt/suffix". For this case, the first sentence does not apply, 
but the second should IMHO apply and the result should be "/unknown/url", 
right? The same thing happens if you don't give a suffix, but just an extension 
and / or suffixes, as in "/unknown/url.txt" or "/unknown/url.tidy.json", which 
IMHO should all return "/unknown/url" if the documentation is right.

This problem occurs with 
[ResourceResolver.resolve(HttpServletRequest,String)|https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#resolve-javax.servlet.http.HttpServletRequest-java.lang.String-]
 , and it shows up if you inspect the SlingHttpRequest after calling an URL 
like  [http://localhost:9090/unknown/url.some.thing].

  was:
I'm not sure whether the documentation or the implementation is wrong here, but 
[https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html#overview]
says:
{quote}For existing resources the resource path is the longest match (also 
considering its 
[mappings|https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html])
 pointing to a resource where the next character is either a dot ({{.}}) or it 
is the full request URI. Otherwise (for a path not matching any existing 
resource) the resource path ends at the _first dot ({{.}})_ in the request url.
{quote}
But when resolving a not existing resource containing a dot, e.g. 
"/unknown/url.txt/suffix" , I surprisingly get a NonExistingResource 
"/unknown/url.txt/suffix". For this case, the first sentence does not apply, 
but the second should IMHO apply and the result should be "/unknown/url", 
right? The same thing happens if you don't give a suffix, but just an extension 
and / or suffixes, as in "/unknown/url.txt" or "/unknown/url.tidy.json", which 
IMHO should all return "/unknown/url".



This problem occurs with 
[ResourceResolver.resolve(HttpServletRequest,String)|https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#resolve-javax.servlet.http.HttpServletRequest-java.lang.String-]
 , and it shows up if you inspect the SlingHttpRequest after calling an URL 
like  http://localhost:9090/unknown/url.some.thing.


> ResourceResolver.resource(request, uri) inconsistency for non existing 
> resources
> --------------------------------------------------------------------------------
>
>                 Key: SLING-9508
>                 URL: https://issues.apache.org/jira/browse/SLING-9508
>             Project: Sling
>          Issue Type: Bug
>          Components: ResourceResolver
>    Affects Versions: Resource Resolver 1.6.16
>            Reporter: Hans-Peter Stoerr
>            Priority: Minor
>
> I'm not sure whether the documentation or the implementation is wrong here, 
> but 
>  
> [https://sling.apache.org/documentation/the-sling-engine/url-decomposition.html#overview]
>  says:
> {quote}For existing resources the resource path is the longest match (also 
> considering its 
> [mappings|https://sling.apache.org/documentation/the-sling-engine/mappings-for-resource-resolution.html])
>  pointing to a resource where the next character is either a dot ({{.}}) or 
> it is the full request URI. Otherwise (for a path not matching any existing 
> resource) the resource path ends at the _first dot ({{.}})_ in the request 
> url.
> {quote}
> But when resolving a not existing resource containing a dot, e.g. 
> "/unknown/url.txt/suffix" , I surprisingly get a NonExistingResource 
> "/unknown/url.txt/suffix". For this case, the first sentence does not apply, 
> but the second should IMHO apply and the result should be "/unknown/url", 
> right? The same thing happens if you don't give a suffix, but just an 
> extension and / or suffixes, as in "/unknown/url.txt" or 
> "/unknown/url.tidy.json", which IMHO should all return "/unknown/url" if the 
> documentation is right.
> This problem occurs with 
> [ResourceResolver.resolve(HttpServletRequest,String)|https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#resolve-javax.servlet.http.HttpServletRequest-java.lang.String-]
>  , and it shows up if you inspect the SlingHttpRequest after calling an URL 
> like  [http://localhost:9090/unknown/url.some.thing].



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to