You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/02/06 11:54:11 UTC
svn commit: r618955 -
/incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java
Author: fmeschbe
Date: Wed Feb 6 02:54:03 2008
New Revision: 618955
URL: http://svn.apache.org/viewvc?rev=618955&view=rev
Log:
SLING-221 applying second patch
Modified:
incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java
Modified: incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java?rev=618955&r1=618954&r2=618955&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java (original)
+++ incubator/sling/trunk/scripting/jsp-taglib/src/main/java/org/apache/sling/scripting/jsp/taglib/IncludeTagHandler.java Wed Feb 6 02:54:03 2008
@@ -27,6 +27,7 @@
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
+import org.apache.sling.api.request.RequestDispatcherOptions;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.jcr.resource.JcrResourceUtil;
import org.apache.sling.jcr.resource.SyntheticResource;
@@ -68,20 +69,14 @@
final SlingHttpServletRequest request = TagUtil.getRequest(pageContext);
- // only try to include, if there is anything to include !!
+ // check for resource otherwise resolve from path
+ RequestDispatcherOptions opts = null;
if (resource == null) {
if (path == null) {
resource = request.getResource();
- // overwrite resource type if needed
- if (resourceType != null
- && !resourceType.equals(resource.getResourceType())) {
- path = resource.getPath();
- resource = null;
- }
} else {
if (!path.startsWith("/")) {
- path = request.getResource().getPath() + "/"
- + JcrResourceUtil.normalize(this.path);
+ path = request.getResource().getPath() + "/" + JcrResourceUtil.normalize(this.path);
}
resource = request.getResourceResolver().getResource(path);
}
@@ -95,6 +90,12 @@
return EVAL_PAGE;
}
resource = new SyntheticResource(path, resourceType);
+ } else {
+ // overwrite resource type if desired
+ if (resourceType != null && !resourceType.equals(resource.getResourceType())) {
+ opts = new RequestDispatcherOptions();
+ opts.put(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE, resourceType);
+ }
}
try {
@@ -104,7 +105,7 @@
pageContext.getOut().flush();
}
// include the rendered content
- RequestDispatcher dispatcher = request.getRequestDispatcher(resource);
+ RequestDispatcher dispatcher = request.getRequestDispatcher(resource, opts);
if (dispatcher != null) {
SlingHttpServletResponse response = new JspSlingHttpServletResponseWrapper(
pageContext);