Class RedirectConfiguration

java.lang.Object
com.adobe.acs.commons.redirects.models.RedirectConfiguration

public class RedirectConfiguration extends Object
A collection of redirect rules
  • Field Details

  • Constructor Details

    • RedirectConfiguration

      public RedirectConfiguration(org.apache.sling.api.resource.Resource resource, String storageSuffix)
  • Method Details

    • normalizePath

      public static String normalizePath(String resourcePath)
      Returns:
      resource path without .html extension
    • getPathRules

      public Map<String,RedirectRule> getPathRules()
    • getCaseInsensitivePathRules

      public Map<String,RedirectRule> getCaseInsensitivePathRules()
    • getPatternRules

      public Map<Pattern,RedirectRule> getPatternRules()
    • getPath

      public String getPath()
    • getName

      public String getName()
    • match

      public RedirectMatch match(String requestPath)
      Match a request path to a redirect configuration Performs two tries:
      1. Match by exact path. This is O(1) lookup in a hashtable keyed by path
      2. Match by a regular expression. This is O(N) linear lookup in a list of rules keyed by their regex patterns
      Parameters:
      requestPath - the request to match
      Returns:
      match or null
      See Also:
    • match

      public RedirectMatch match(String resourcePath, String contextPrefix, org.apache.sling.api.SlingHttpServletRequest request)
      Match a request path to a redirect configuration Performs two tries:
      1. Match by exact path. This is O(1) lookup in a hashtable keyed by path
      2. Match by a regular expression. This is O(N) linear lookup in a list of rules keyed by their regex patterns
      Parameters:
      resourcePath - the request to match
      contextPrefix - the optional context prefix to take into account
      request - the current sling request
      Returns:
      match or null