Markus Haack created SLING-3338:
-----------------------------------

             Summary: SlingHttpServletResponseImpl.encodeUrl(String) return 
wrong Url in multiple domain setups
                 Key: SLING-3338
                 URL: https://issues.apache.org/jira/browse/SLING-3338
             Project: Sling
          Issue Type: Bug
          Components: Engine
            Reporter: Markus Haack


The <c:url> JSTL tag (org.apache.taglibs.standard.tag.rt.core.UrlTag) does not 
work with multi domain mappings configured to the same path.

org.apache.taglibs.standard.tag.rt.core.UrlTag uses
org.apache.taglibs.standard.tag.common.core.UrlSupport which calls
response.encodeURL(result); in the doEndTag method. That goes down to
org.apache.sling.engine.impl.SlingHttpServletResponseImpl.encodeUrl(String).

SlingHttpServletResponseImpl.encodeUrl calls 
SlingHttpServletResponseImpl.map(String) without the request. This can result 
in wrong mapping if more than one mapping matches always the frist one is 
picked.

Can be reproduces by using the following mapping 
config:(http://localhost:4503/etc/map/http.tidy.-1.json):

{
  "jcr:primaryType": "sling:Folder",
  "host-a1.com": {
    "jcr:createdBy": "admin",
    "sling:internalRedirect": [
      "/content/a",
      "/"
    ],
  "jcr:primaryType": "sling:Mapping"
  },
  "host-a2.com": {
    "sling:internalRedirect": [
      "/content/a",
      "/"
    ],
    "jcr:primaryType": "sling:Mapping"
  }
}

When using <c:url> to encode a link a request on host-a1.com works fine. The 
return value of the tag is a relative link. Access via host-a2.com is broken 
and <c:url> return a full link pointing to domain hoas-a1.com.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to