justinedelson commented on a change in pull request #3: SLING-7321 
ChildResourceViaProvider support wrapping request
URL: 
https://github.com/apache/sling-org-apache-sling-models-impl/pull/3#discussion_r158327783
 
 

 ##########
 File path: 
src/main/java/org/apache/sling/models/impl/via/ChildResourceViaProvider.java
 ##########
 @@ -40,8 +46,36 @@ public Object getAdaptable(Object original, String value) {
         }
         if (original instanceof Resource) {
             return ((Resource) original).getChild(value);
+        } else if (original instanceof SlingHttpServletRequest) {
+            final SlingHttpServletRequest request = (SlingHttpServletRequest) 
original;
+            final Resource resource = request.getResource();
+            if (resource == null) {
+                return null;
+            }
+            Resource child = resource.getChild(value);
+            if (child == null) {
+                log.debug("could not obtain child {} of resource {}", value, 
resource.getPath());
 
 Review comment:
   Please upper case "could" as "Could"

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to