incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r758695 - /incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
Date Thu, 26 Mar 2009 15:43:38 GMT
Author: fmeschbe
Date: Thu Mar 26 15:43:22 2009
New Revision: 758695

URL: http://svn.apache.org/viewvc?rev=758695&view=rev
Log:
SLING-898 Overwrite the SyntheticResource used to provide a resource super type

Modified:
    incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java

Modified: incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java?rev=758695&r1=758694&r2=758695&view=diff
==============================================================================
--- incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
(original)
+++ incubator/sling/trunk/bundles/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/AbstractDispatcherTagHandler.java
Thu Mar 26 15:43:22 2009
@@ -31,8 +31,10 @@
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.request.RequestDispatcherOptions;
 import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceUtil;
 import org.apache.sling.api.resource.SyntheticResource;
+import org.apache.sling.jcr.resource.JcrResourceUtil;
 import org.apache.sling.scripting.jsp.util.JspSlingHttpServletResponseWrapper;
 import org.apache.sling.scripting.jsp.util.TagUtil;
 import org.slf4j.Logger;
@@ -103,7 +105,7 @@
                 // check whether the path (would) resolve, else SyntheticRes.
                 Resource tmp = request.getResourceResolver().resolve(path);
                 if (tmp == null && resourceType != null) {
-                    resource = new SyntheticResource(
+                    resource = new DispatcherSyntheticResource(
                         request.getResourceResolver(), path, resourceType);
 
                     // remove resource type overwrite as synthetic resource
@@ -180,4 +182,24 @@
     public void setReplaceSuffix(String suffix) {
         this.replaceSuffix = suffix;
     }
+
+    /**
+     * The <code>DispatcherSyntheticResource</code> extends the
+     * <code>SyntheticResource</code> class overwriting the
+     * {@link #getResourceSuperType()} method to provide a possibly non-
+     * <code>null</code> result.
+     */
+    private static class DispatcherSyntheticResource extends SyntheticResource {
+
+        public DispatcherSyntheticResource(ResourceResolver resourceResolver,
+                String path, String resourceType) {
+            super(resourceResolver, path, resourceType);
+        }
+
+        @Override
+        public String getResourceSuperType() {
+            return JcrResourceUtil.getResourceSuperType(getResourceResolver(),
+                getResourceType());
+        }
+    }
 }



Mime
View raw message