[
https://issues.apache.org/jira/browse/SLING-4607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14510730#comment-14510730
]
Robert Munteanu commented on SLING-4607:
----------------------------------------
[~georg.koester] - I reviewed the pull request and it looks good. However, I
wanted to test if the request.adaptTo behaviour appears in the production code
as well, and it does not .My test was the following ( on an empty Sling
Launchpad 7 instance ):
{noformat}
curl -u admin:admin -X POST -F"sling:resourceType=my/testscript"
http://localhost:8080/content
curl -u admin:admin -X MKCOL http://localhost:8080/apps/my
curl -u admin:admin -X MKCOL http://localhost:8080/apps/my/testscript
curl -u admin:admin -T testscript.jsp
http://localhost:8080/apps/my/testscript/html.jsp
{noformat}
{code:title=testscript.jsp}
<%@taglib prefix="sling" uri="http://sling.apache.org/taglibs/sling" %>
<sling:defineObjects />
slingRequest.adaptTo(Resource.class): <%=
slingRequest.adaptTo(org.apache.sling.api.resource.Resource.class) %> <br />
slingRequest.getResource() : <%= slingRequest.getResource() %>
{code}
The result I get is
{noformat}slingRequest.adaptTo(Resource.class): null
slingRequest.getResource() : JcrNodeResource, type=my/testscript,
superType=null, path=/content {noformat}
Does this work for you with production code?
> Implement MockSlingHttpServletRequest.adaptTo(Resource.class)
> -------------------------------------------------------------
>
> Key: SLING-4607
> URL: https://issues.apache.org/jira/browse/SLING-4607
> Project: Sling
> Issue Type: Improvement
> Components: Testing
> Affects Versions: Commons Testing 2.0.16
> Reporter: Georg Koester
> Assignee: Robert Munteanu
> Priority: Minor
>
> {code}
> request = new MockSlingHttpServletRequest(...);
> request.setResource(resource);
> assertSame(resource, request.getResource());
> assertSame(resource, request.adaptTo(Resource.class));
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)