[ 
https://issues.apache.org/jira/browse/SLING-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12649333#action_12649333
 ] 

Felix Meschberger commented on SLING-249:
-----------------------------------------

I am now taking this issue up after it has been laying around for too long ...

And here is my proposal:

The JcrResourceResolver is extended to support path mappings considering the 
Host request header.

    * Configuration is provided to map the Host header to a resource prefix.
    * Additional configuration is added to define a default mapping.
    * The default configuration ignores the Host headers and uses the request 
URL unmodified for further mappings.

In contrast to other mappings which just take the request URL into 
consideration, this configuration also takes a request header into 
consideration. Therefore this solution will only have an effect on the 
implementation of the ResourceResolver.resovle(HttpServletRequest) method. The 
implementation for the ResourceResolver.resolve(String) is not affected by this 
extension.

Furthermore, the functionality of the ResourceResolver.map(String) method is 
not modified and this addition has no influence on this method which continues 
to return an (absolute) resource path. Instead we add a new API method 
ResourceResolver.map(HttpServletRequest, String) which returns an URL 
constructed from the request and resource path as follows:

   1. The resource path is first mapped by calling the 
ResourceResolver.map(String) method
   2. The resulting path is then applied to the reverse virtual host mapping.
   3. An URL is returned composed as follows: 

    * Scheme from the request
    * Host from virtual host mapping, defaulting to Host header from request
    * Path consisting of context path and mapped resource path

For consistency with the new map(HttpServletRequest, String) method (and also 
to provide more flexibility for resource resolution) the 
resolve(HttpServletRequest) method is deprecated in favor of a new 
resolve(HttpServletRequest, String) method. The deprecated method is defined 
such that implementations must call resolve(HttpServletRequest, String) where 
the string argument is the HttpServletRequest.getPathInfo() value.

> Allow mapping nodes to internet domains
> ---------------------------------------
>
>                 Key: SLING-249
>                 URL: https://issues.apache.org/jira/browse/SLING-249
>             Project: Sling
>          Issue Type: New Feature
>          Components: Engine
>            Reporter: Vidar S. Ramdal
>            Assignee: Felix Meschberger
>
> Sling should support hosting multiple domains, with different JCR roots.
> E.g.:
> http://www.domain1.com could map to /content/domain1.com
> http://www.domain2.com could map to /content/domain2.com
> While developing a website, the fully qualified domain might not be 
> available. Ideally, the mapping could be configured in a flexible way. One 
> option would be to maintain a set of regular expressions to match against 
> URLs. Each regexp would then match to a path in the JCR.

-- 
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