Resorce Resolver Mapping - Better Support for Multiple Domain/Protocol Mapping
------------------------------------------------------------------------------

                 Key: SLING-1421
                 URL: https://issues.apache.org/jira/browse/SLING-1421
             Project: Sling
          Issue Type: Improvement
          Components: JCR
    Affects Versions: JCR Resource 2.0.6
            Reporter: Stefan Seifert
             Fix For: JCR Resource 2.0.8
         Attachments: 100303_slingtest-mapping.zip

in our sling CMS-based web projects we've the following scenario:
* most pages of a website are accessed via HTTP, but some of the via HTTPs 
(e.g. including forms submitting personal data)
* at the same time we use the mapping features at /etc/map to shorten the urls 
for a given domain name
* in fact we have to configure two mappings for two domain names (one for HTTP 
and one for HTTPS), pointing to the same start path in JCR

with this configuration in place the sling ResourceResolver.map method 
sometimes produces unexpected or incorrect results with the current 
implementation.
if the current host name and port does not match with the configured mapping 
host name and port sling automatically adds protocol, host name and port from 
the configuration to the result of the map method. but in the case above with 
multiple mappings for the same start path this cannot produce correct results, 
because the decision whether the secure or non-secure domain name should be 
chosen is custom application logic.

i'm not sure what the best solution is for this problem, because the current 
implementation makes sense in some way and works well for the simple scenarios. 
but in complex scenarios with multiple domain mappings it would be more 
practical to use the map method only for shortening the urls and not for adding 
the hostname.

of course it is possible to parse the value of the map method and strip off any 
hostname returned manually and add an own one, but this seems not "right". and 
if the cms does a check if the internal url is valid this url can be treated as 
invalid.

for easy reproduction of the scenario i've attached a simple test project 
[^100303_slingtest-mapping.zip]. please deploy it to a sling instance using 
"mvn install" and then call in the intro page 
http://localhost:8080/content/slingtest-mapping.html and follow the 
instructions on the page (two host names have to be added to the local hosts 
file). the test project contains two templates/jsp components, a configuration 
at /etc/map with two domain names pointing to the same path and some sample 
content nodes.

depending whether a default mapping "/content/-/" is configured in "apache 
sling resource resolver" the generated links on the "site 1" test page are 
correct. but the links generate on the "site 2" test pages are wrong.

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

Reply via email to