org.opencms.site
Class CmsSiteMatcher

java.lang.Object
  extended by org.opencms.site.CmsSiteMatcher
All Implemented Interfaces:
java.lang.Cloneable

public final class CmsSiteMatcher
extends java.lang.Object
implements java.lang.Cloneable

A matcher object to compare request data against the configured sites.

Since:
6.0.0
Version:
$Revision: 1.26 $
Author:
Alexander Kandzior

Field Summary
static CmsSiteMatcher DEFAULT_MATCHER
          Default matcher that always matches all other Site matchers.
 
Constructor Summary
CmsSiteMatcher(java.lang.String serverString)
          Construct a new site matcher from a String which should be in default URL notation.
CmsSiteMatcher(java.lang.String serverString, long timeOffset)
          Construct a new site matcher from a String which should be in default URL notation.
CmsSiteMatcher(java.lang.String serverProtocol, java.lang.String serverName, int serverPort)
          Constructs a new site matcher object.
CmsSiteMatcher(java.lang.String serverProtocol, java.lang.String serverName, int serverPort, long timeOffset)
          Constructs a new site matcher object.
 
Method Summary
 java.lang.Object clone()
          Returns a clone of this Objects instance.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getServerName()
          Returns the hostname (e.g. localhost) which is required to access this site.
 int getServerPort()
          Returns the port (e.g. 80) which is required to access this site.
 java.lang.String getServerProtocol()
          Returns the protocol (e.g.
 long getTimeOffset()
          Returns the time Offset.
 java.lang.String getUrl()
          Returns the url of this site matcher.
 int hashCode()
           
protected  void setServerName(java.lang.String serverName)
          Sets the hostname (e.g. localhost) which is required to access this site.
protected  void setServerPort(int serverPort)
          Sets the port (e.g. 80) which is required to access this site.
protected  void setServerProtocol(java.lang.String serverProtocol)
          Sets the protocol (e.g.
protected  void setTimeOffset(long timeOffset)
          Sets the time Offset in seconds.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_MATCHER

public static final CmsSiteMatcher DEFAULT_MATCHER
Default matcher that always matches all other Site matchers.

Constructor Detail

CmsSiteMatcher

public CmsSiteMatcher(java.lang.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(java.lang.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(java.lang.String serverProtocol,
                      java.lang.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(java.lang.String serverProtocol,
                      java.lang.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 Detail

clone

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

Overrides:
clone in class java.lang.Object
Returns:
a clone of this instance

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getServerName

public java.lang.String 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

public java.lang.String 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 java.lang.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 java.lang.Object
See Also:
Object.hashCode()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

setServerName

protected void setServerName(java.lang.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(java.lang.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