Class WCMScriptHelper


  • @ProviderType
    public class WCMScriptHelper
    extends java.lang.Object
    The WCMScriptHelper class provides helper methods to support CQ Sightly extensions. This is to be used only with the CQ specific Sightly plugins. This class is not meant to be extended.
    • Method Detail

      • includeResource

        public void includeResource​(java.io.PrintWriter out,
                                    java.lang.String script,
                                    java.lang.String dispatcherOptions,
                                    java.lang.String resourceType,
                                    WCMResourceOptions wcmResourceOptions)
        Include the resource and redirect the output into a custom print writer.
        Parameters:
        out - the custom writer
        script - the path of the resource to include
        dispatcherOptions - key=value comma separated pairs as String
        resourceType - Sling resource type to be used while including the resource
        wcmResourceOptions - the WCM specific options for including the resource
      • includeResource

        public void includeResource​(SlingHttpServletResponse customResponse,
                                    java.lang.String script,
                                    java.lang.String dispatcherOptions,
                                    java.lang.String resourceType,
                                    WCMResourceOptions wcmResourceOptions)
        Include a resource and redirect the output into a custom response.
        Parameters:
        customResponse - the custom response
        script - the path of the resource to include
        dispatcherOptions - key=value comma separated pairs as String
        resourceType - Sling resource type to be used while including the resource
        wcmResourceOptions - the WCM specific options for including the resource
      • includeResource

        public void includeResource​(SlingHttpServletResponse response,
                                    java.lang.String script,
                                    java.lang.String dispatcherOptions,
                                    java.lang.String resourceType,
                                    WCMResourceOptions wcmResourceOptions,
                                    java.util.Map<java.lang.String,​java.lang.Object> resourceProperties)
        Include a SyntheticResource and redirect the output into a custom response.
        Parameters:
        response - the custom response
        script - the path of the resource to include
        dispatcherOptions - key=value comma separated pairs as String
        resourceType - Sling resource type to be used while including the resource
        wcmResourceOptions - the WCM specific options for including the resource
        resourceProperties - the properties of the SyntheticResource that will be included
      • includeResource

        public void includeResource​(SlingHttpServletResponse response,
                                    Resource resource,
                                    java.lang.String dispatcherOptions,
                                    java.lang.String resourceType,
                                    WCMResourceOptions wcmResourceOptions)
        Include a Resource and redirect the output into a custom response
        Parameters:
        response - the custom response
        resource - the Resource to include
        dispatcherOptions - key=value comma separated pairs as String
        resourceType - Sling resource type to be used while including the resource
        wcmResourceOptions - the WCM specific options for including the resource
      • includeScript

        public void includeScript​(java.lang.String script,
                                  java.lang.String wcmMode,
                                  java.io.PrintWriter out)
        Calls the given script.
        Parameters:
        script - script path to be called
        wcmMode - WCM mode to be used, its an optional parameter. If the current request contains mode attribute, it will be reset after the script call.