Package org.apache.sling.api.request

Examples of org.apache.sling.api.request.RequestDispatcherOptions


        for (String index : indexFiles) {
            Resource fileRes = resolver.getResource(resource, index);
            if (fileRes != null && !ResourceUtil.isSyntheticResource(fileRes)) {

                // include the index resource with no suffix and selectors !
                RequestDispatcherOptions rdo = new RequestDispatcherOptions();
                rdo.setReplaceSuffix("");
                rdo.setReplaceSelectors("");

                RequestDispatcher dispatcher;
                if (index.indexOf('.') < 0) {
                    String filePath = fileRes.getPath() + ".html";
                    dispatcher = request.getRequestDispatcher(filePath, rdo);
View Full Code Here


        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 {
View Full Code Here

        // the JSP has been invalidated
        Map<String, String> props = Collections.singletonMap(
                SlingConstants.PROPERTY_PATH, script.getPath());
        eventAdmin.sendEvent(new Event(SlingConstants.TOPIC_RESOURCE_CHANGED, props));

        final RequestDispatcherOptions options = new RequestDispatcherOptions();
        options.setForceResourceType(Constants.PSEDUO_COMPONENT_PATH);
        options.setReplaceSelectors("");

        // Suppress ACS AEM Commons - Component Error Handler from capturing errors
        request.setAttribute("com.adobe.acs.commons.wcm.component-error-handler.suppress", true);

        RequestDispatcher dispatcher = request.getRequestDispatcher(resource, options);
View Full Code Here

    MutableUrl url = new MutableUrl(request, false);
    String resourceType = getResourceTypeFromSuffix(request);
    boolean synthetic = ResourceUtil.isSyntheticResource(request.getResource());

    if (synthetic && config.isSupportedResourceType(resourceType, request)) {
      RequestDispatcherOptions options = new RequestDispatcherOptions();
      options.setForceResourceType(resourceType);

      Resource res = request.getResource();
      String existingResource = getParentExistingResource(res.getPath(), res.getResourceResolver());

      String path = url.getPath();
View Full Code Here

    String resourceType = resource.getResourceType();

    if (config.isSupportedResourceType(resourceType, request)) {
      url.removeSelector(config.getIncludeSelector());

      RequestDispatcherOptions options = new RequestDispatcherOptions();
      RequestDispatcher dispatcher = request.getRequestDispatcher(url.toString(), options);
      request.setAttribute(INCLUDED_ATTRIBUTE, Boolean.TRUE);
      dispatcher.include(request, response);
    } else {
      LOG.error("User tries to include " + resourceType
View Full Code Here

TOP

Related Classes of org.apache.sling.api.request.RequestDispatcherOptions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.