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

Tobias Bocanegra commented on SLING-227:
----------------------------------------

the problem is along this lines:

                // check whether the path (would) resolve, else SyntheticRes.
                Resource tmp = request.getResourceResolver().resolve(path);
                if (tmp == null && resourceType != null) {
                    opts = null; // not needed
                    resource = new SyntheticResource(path, resourceType);
                }

here the 'tmp' resolves to 'this' resource instead to no one. could this be 
related to the new
resolution stuff ?

debugging of <sling:inlcude path="header"/> on 
/content/geometrixx/en/about/cq:content shows:
normalized path = /content/geometrixx/en/about/cq:content/header
tmp = JcrNodeResource, type=geometrixx/components/contentpage, 
path=/content/geometrixx/en/about/cq:content

the problem is, that the requested resource does not exist, and the sling 
include used to ignore this include. now the resource resolution returns the 
parent resource:

  private Resource scanPath(String uriPath, String httpMethod)
            throws SlingException {
        Resource resource = null;
        String curPath = uriPath;
        try {
            final ResourcePathIterator it = new ResourcePathIterator(uriPath,
                httpMethod);
            while (it.hasNext() && resource == null) {
                curPath = it.next();
                resource = getResourceInternal(curPath);
            }
        } catch (Exception ex) {
            throw new SlingException("Problem trying " + curPath
                + " for request path " + uriPath, ex);
        }

        return resource;
    }


> sling:include tag: use ResourceResolver.resolve(String) method to get the 
> resource
> ----------------------------------------------------------------------------------
>
>                 Key: SLING-227
>                 URL: https://issues.apache.org/jira/browse/SLING-227
>             Project: Sling
>          Issue Type: Bug
>          Components: JSP
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: 2.0.0
>
>
> In case of using the path attribute of the sling:include tag, the resource is 
> resolved from that path using the ResourceResolver.getResource() method. If 
> the path contains any selectors and/or extension, the getResource() method 
> fails.
> The sling:include tag should be fixed to request a RequestDispatcher based on 
> the path if the path attribute is given instead of resolving the resource 
> itself, because this duplicates code.

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