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

Julian Sedding commented on SLING-2533:
---------------------------------------

IMHO the described issue is actually consistent behaviour. The 
SlingServletResolver has the concept of default extensions (html by default), 
which allow the extension name to be omitted in the script name. That's why 
your example works with the "html" extension, but not with a "txt" extension. 
I.e. selector.html.jsp is equivalent to selector.jsp, but selector.txt.jsp is 
not.

Consider the above example to be the "empty extension". The "empty extension" 
is not in the set of default extensions and therefore is treated like the "txt" 
extension. I.e. selector.<empty extension>.jsp is not equivalent to 
selector.jsp. Since writing the empty extension is a bit difficult the method 
name becomes necessary, which leads to say that selector.GET.jsp is only 
equivalent to selector.jsp if a default extension is used, but not in the case 
of the "empty extension".

FWIW, you can work around this issue quite easily by specifying a default 
extension in your sling:include. E.g. <sling:include path=".special.html" 
resourceType="test/sometype"/> should do the trick. Beware of unforeseen 
consequences further down the inlcude stack.

Sling was designed for use *with* extensions, therefore your mileage *without* 
may vary. (I'm actually surprised that it works so well.)

                
> ResourceCollector fails to resolve selector scripts when no extension is used
> -----------------------------------------------------------------------------
>
>                 Key: SLING-2533
>                 URL: https://issues.apache.org/jira/browse/SLING-2533
>             Project: Sling
>          Issue Type: Bug
>          Components: Servlets
>    Affects Versions: Servlets Resolver 2.1.2
>         Environment: this applies to version 2.1.3-SNAPSHOT
>            Reporter: Tyson Norris
>         Attachments: sling-2533.patch
>
>
> A specific use case where this comes up is:
> request: http://localhost:4502/content/test/include
> In JCR repo:
> - node at content/test/include has sling:resourceType=test/main
> - script to render this resource is /apps/test/main/GET.jsp
> - script to render different type with selector referneced via:
> <sling:include resourceType="test/sometype" replaceSelectors="special"/>
> - script to render the different type is /apps/test/sometype/special.jsp 
> in this case, special.jsp script is only resoved if renamed to special.GET.jsp
> Note that:
> - no extension on requested URL
> - using a replaced selector in sling:include should behave similar to 
> specifying an exentsion when the extension is null, I think. 
> See attached patch to ResourceCollector and ScriptSelectionTest 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to