* @return whether additional evaluations of the body are desired
*/
public int doEndTag() throws JspException {
log.debug("AbstractDispatcherTagHandler.doEndTag");
final SlingHttpServletRequest request = TagUtil.getRequest(pageContext);
// set request dispatcher options according to tag attributes. This
// depends on the implementation, that using a "null" argument
// has no effect
final RequestDispatcherOptions opts = new RequestDispatcherOptions();
opts.setForceResourceType(resourceType);
opts.setReplaceSelectors(replaceSelectors);
opts.setAddSelectors(addSelectors);
opts.setReplaceSuffix(replaceSuffix);
// ensure the path (if set) is absolute and normalized
if (path != null) {
if (!path.startsWith("/")) {
path = request.getResource().getPath() + "/" + path;
}
path = ResourceUtil.normalize(path);
}
// check the resource
if (resource == null) {
if (path == null) {
// neither resource nor path is defined, use current resource
resource = request.getResource();
} else {
// check whether the path (would) resolve, else SyntheticRes.
Resource tmp = request.getResourceResolver().resolve(path);
if (tmp == null && resourceType != null) {
resource = new DispatcherSyntheticResource(
request.getResourceResolver(), path, resourceType);
// remove resource type overwrite as synthetic resource
// is correctly typed as requested
opts.remove(RequestDispatcherOptions.OPT_FORCE_RESOURCE_TYPE);
}
}
}
try {
// create a dispatcher for the resource or path
RequestDispatcher dispatcher;
if (resource != null) {
dispatcher = request.getRequestDispatcher(resource, opts);
} else {
dispatcher = request.getRequestDispatcher(path, opts);
}
if (dispatcher != null) {
SlingHttpServletResponse response = new JspSlingHttpServletResponseWrapper(
pageContext);