Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-9508

ResourceResolver.resource(request, uri) inconsistency for non existing resources

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: Resource Resolver 1.6.16
    • Fix Version/s: None
    • Component/s: ResourceResolver
    • Labels:
      None

      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:

      For existing resources the resource path is the longest match (also considering its mappings) 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.

      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) , and it shows up if you inspect the SlingHttpRequest after calling an URL like  http://localhost:9090/unknown/url.some.thing.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              hanspeterstoerr Hans-Peter Stoerr
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: