Helper class to provide rendering functions to the Javascript engine

Constructors

Methods

  • Add a cache dependency to the current resource. This will be used to flush the current resource when the dependencies are modified.

    Parameters

    • attr: any

      may be the following:

               node (JCRNodeWrapper) : The node to add as a dependency. 
      uuid (String) : The UUID of the node to add as a dependency.
      path (String) : The path of the node to add as a dependency.
      flushOnPathMatchingRegexp (String) : A regular expression that will be used to flush the cache
      when the path of the modified nodes matches the regular expression.
    • renderContext: RenderContext

      the current rendering context

    Returns void

    Throws

    IllegalAccessException if the underlying tag cannot be accessed

    Throws

    InvocationTargetException if the underlying tag cannot be invoked

    Throws

    JspException if the underlying tag throws a JSP exception

    Throws

    IOException if the underlying tag throws an IO exception

  • Render a tag that adds resources to the page. Resources might for example be CSS files, Javascript files or inline

    Parameters

    • attr: any

      may contain the following:

               insert (boolean) : If true, the resource will be inserted into the document. Typically used
      for on-demand loading of resources.
      async (boolean) : If true, the resource will be loaded asynchronously. For scripts, this means
      the script
      will be executed as soon as it's available, without blocking the rest of the page.
      defer (boolean) : If true, the resource will be deferred, i.e., loaded after the document
      has been parsed.
      For scripts, this means the script will not be executed until after the page has loaded.
      type (string) : The type of the resource. This could be 'javascript' for .js files, 'css' for
      .css files, etc.
      The type will be used to resolve the directory in the module where the resources are located. For example
      for the 'css' type it will look for the resources in the css directory of the module.
      resources (string) : The path to the resource file, relative to the module. It is also allowed to
      specify multiple resources by separating them with commas. It is also allowed to use absolute URLs to
      include remote resources.
      inlineResource (string) : Inline HTML that markup will be considered as a resource.
      title (string) : The title of the resource. This is typically not used for scripts or stylesheets,
      but may be used for other types of resources.
      key (string) : A unique key for the resource. This could be used to prevent duplicate resources
      from being added to the document.
      targetTag (string): The HTML tag where the resource should be added. This could be 'head' for
      resources that should be added to the <head> tag, 'body' for resources that should be added to
      the <body> tag, etc.
      rel (string) : The relationship of the resource to the document. This is typically 'stylesheet'
      for CSS files.
      media (string) : The media for which the resource is intended. This is typically used for CSS
      files, with values like 'screen', 'print', etc.
      condition (string) : A condition that must be met for the resource to be loaded. This could be
      used for conditional comments in IE, for example.
    • renderContext: RenderContext

      the current rendering context

    Returns string

    a String containing the rendered HTML tags for the provided resources.

    Throws

    IllegalAccessException if the underlying tag cannot be accessed

    Throws

    InvocationTargetException if the underlying tag cannot be invoked

    Throws

    JspException if the underlying tag throws a JSP exception

    Throws

    IOException if the underlying tag throws an IO exception

  • Does a URL encoding of the path. The characters that don't need encoding are those defined 'unreserved' in section 2.3 of the 'URI generic syntax' RFC 2396. Not the entire path string is escaped, but every individual part (i.e. the slashes are not escaped).

    Parameters

    • path: string

      the path to encode

    Returns string

    a String containing the escaped path

    Throws

    NullPointerException if path is null.