Class CmsSiteMatcher

java.lang.Object
org.opencms.site.CmsSiteMatcher
All Implemented Interfaces:
Serializable, Cloneable

public final class CmsSiteMatcher extends Object implements Cloneable, Serializable
A matcher object to compare request data against the configured sites.

Since:
6.0.0
See Also:
  • Field Details

  • Constructor Details

    • CmsSiteMatcher

      public CmsSiteMatcher(String serverString)
      Construct a new site matcher from a String which should be in default URL notation.

      If no port is provided, the default port 80 or 443 will be used for http or https respectively. If no protocol is provided, the default protocol "http" will be used.

      Parameters:
      serverString - the String, e.g. http://localhost:8080
    • CmsSiteMatcher

      public CmsSiteMatcher(String serverString, long timeOffset)
      Construct a new site matcher from a String which should be in default URL notation.

      If no port is provided, the default port 80 or 443 will be used for http or https respectively. If no protocol is provided, the default protocol "http" will be used.

      Parameters:
      serverString - the String, e.g. http://localhost:8080
      timeOffset - the time offset
    • CmsSiteMatcher

      public CmsSiteMatcher(String serverProtocol, String serverName, int serverPort)
      Constructs a new site matcher object.

      Parameters:
      serverProtocol - to protocol required to access this site
      serverName - the server URL prefix to which this site is mapped
      serverPort - the port required to access this site
    • CmsSiteMatcher

      public CmsSiteMatcher(String serverProtocol, String serverName, int serverPort, long timeOffset)
      Constructs a new site matcher object.

      Parameters:
      serverProtocol - to protocol required to access this site
      serverName - the server URL prefix to which this site is mapped
      serverPort - the port required to access this site
      timeOffset - the time offset
  • Method Details

    • clone

      public Object clone()
      Returns a clone of this Objects instance.

      Overrides:
      clone in class Object
      Returns:
      a clone of this instance
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • equalsIgnoreScheme

      public boolean equalsIgnoreScheme(CmsSiteMatcher matcher)
      Checks if this site matcher equals another site matcher, ignoring the scheme.
      Parameters:
      matcher - the matcher to compare
      Returns:
      true if the site matchers are equal
    • forDifferentScheme

      Generates a site matcher equivalent to this one but with a different scheme.

      Parameters:
      scheme - the new scheme
      Returns:
      the new site matcher
    • getRedirectMode

      Gets the redirect mode.
      Returns:
      the redirect mode
    • getServerName

      Returns the hostname (e.g. localhost) which is required to access this site.

      Returns:
      the hostname (e.g. localhost) which is required to access this site
    • getServerPort

      public int getServerPort()
      Returns the port (e.g. 80) which is required to access this site.

      Returns:
      the port (e.g. 80) which is required to access this site
    • getServerProtocol

      Returns the protocol (e.g. "http", "https") which is required to access this site.

      Returns:
      the protocol (e.g. "http", "https") which is required to access this site
    • getTimeOffset

      public long getTimeOffset()
      Returns the time Offset.

      Returns:
      the time Offset
    • getUrl

      public String getUrl()
      Returns the url of this site matcher.

      Returns:
      the url, i.e. {protocol}://{servername}[:{port}], port appened only if != 80
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • isRedirect

      public boolean isRedirect()
      Is alias to be redirected?
      Returns:
      boolean
    • setRedirectMode

      Set redirect.

      Parameters:
      redirect - boolean
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
    • setServerName

      protected void setServerName(String serverName)
      Sets the hostname (e.g. localhost) which is required to access this site.

      Setting the hostname to "*" is a wildcard that matches all hostnames

      Parameters:
      serverName - the hostname (e.g. localhost) which is required to access this site
    • setServerPort

      protected void setServerPort(int serverPort)
      Sets the port (e.g. 80) which is required to access this site.

      Setting the port to 0 (zero) is a wildcard that matches all ports

      Parameters:
      serverPort - the port (e.g. 80) which is required to access this site
    • setServerProtocol

      protected void setServerProtocol(String serverProtocol)
      Sets the protocol (e.g. "http", "https") which is required to access this site.

      Setting the protocol to "*" is a wildcard that matches all protocols.

      Parameters:
      serverProtocol - the protocol (e.g. "http", "https") which is required to access this site
    • setTimeOffset

      protected void setTimeOffset(long timeOffset)
      Sets the time Offset in seconds.

      Parameters:
      timeOffset - the time Offset to set