Class LinkCheckerSettings


  • public class LinkCheckerSettings
    extends java.lang.Object
    Settings that control the behaviour of the LinkChecker. The settings are used as a "linkchecker context" that holds the base-ref and context uri, and to control the actual rewrite behavior. If "request" is not attached, they are used merely temporary before the actual linkchecker is initialized.
    • Field Detail

      • REQUEST_ATTRIBUTE_NAME

        public static final java.lang.String REQUEST_ATTRIBUTE_NAME
        the name of the request attribute
    • Constructor Detail

      • LinkCheckerSettings

        public LinkCheckerSettings()
    • Method Detail

      • fromRequest

        public static LinkCheckerSettings fromRequest​(SlingHttpServletRequest request)
        Returns the current link checker settings for the current request.
        Parameters:
        request - the request
        Returns:
        the settings or null
      • init

        public void init​(SlingHttpServletRequest request)
        Attach the settings to the request.
        Parameters:
        request - The current request
      • getResourceResolver

        public ResourceResolver getResourceResolver()
        Returns the resource resolver
        Returns:
        the resource resolver
      • getContextPath

        public java.lang.String getContextPath()
        Returns the context path
        Returns:
        the context path
      • getContextURI

        public java.net.URI getContextURI()
        Returns the context URI of the web application associated with the given settings.
        Returns:
        context URI, or null if the URI malformed
        Since:
        5.3
      • getInvalidConfig

        public LinkRewriteConfig getInvalidConfig()
        Returns the config for invalid links
        Returns:
        the config for invalid links
      • setInvalidConfig

        public void setInvalidConfig​(LinkRewriteConfig config)
        Sets the config for invalid links
        Parameters:
        config - the config
      • getExpiredConfig

        public LinkRewriteConfig getExpiredConfig()
        Returns the config for expired links
        Returns:
        the config for expired links
      • setExpiredConfig

        public void setExpiredConfig​(LinkRewriteConfig config)
        Sets the config for expired links
        Parameters:
        config - the config
      • getPredatedConfig

        public LinkRewriteConfig getPredatedConfig()
        Returns the config for predated links
        Returns:
        the config
      • setPredatedConfig

        public void setPredatedConfig​(LinkRewriteConfig config)
        Sets the config for predated links
        Parameters:
        config - the config
      • getRequestURI

        public java.lang.String getRequestURI()
        Get the current request uri.
        Returns:
        the request uri
      • getParentRequestURI

        public java.lang.String getParentRequestURI()
        Return a uri to the parent of the current uri.
        Returns:
        the parent uri or an empty string
      • getBaseRef

        public java.lang.String getBaseRef()
        Get the current base ref.
        Returns:
        the base href
      • getBaseURI

        public java.net.URI getBaseURI()
        Returns the base URI of the request associated with the given settings.
        Returns:
        base URI, or null if the URI malformed
        Since:
        5.3
      • setBaseRef

        public void setBaseRef​(java.lang.String baseRef)
        Set the current base ref.
        Parameters:
        baseRef - the base href
      • isIgnoreInternals

        public boolean isIgnoreInternals()
        If true internal links are not checked
        Returns:
        true if internal links are not checked
      • setIgnoreInternals

        public boolean setIgnoreInternals​(boolean ignoreInternals)
        Controls if internal links should be checked by the linkchecker. If set to true all internal links are treated as 'valid'. Please note that the settings are directly used by the linkchecker transformer and are respected on a "startElement" event. When altered on-the-fly in a JSP don't forget to flush the writer before changing the value.
        Parameters:
        ignoreInternals - if true internal links are not checked
        Returns:
        previous value
      • isIgnoreExternals

        public boolean isIgnoreExternals()
        If true, external links are not checked
        Returns:
        true if external links are not checked
      • setIgnoreExternals

        public boolean setIgnoreExternals​(boolean ignoreExternals)
        Controls if external links should be checked by the linkchecker. If set to true all external links are treated as 'valid' and they are also not recorded in the external-link storage. Please note that the settings are directly used by the linkchecker transformer and are respected on a "startElement" event. When altered on-the-fly in a JSP don't forget to flush the writer before changing the value.
        Parameters:
        ignoreExternals - if true external links are not checked
        Returns:
        previous value