Package org.opencms.site
Class CmsSiteMatcher
java.lang.Object
org.opencms.site.CmsSiteMatcher
- All Implemented Interfaces:
Serializable
,Cloneable
A matcher object to compare request data against the configured sites.
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents the different redirect modes for a site alias. -
Field Summary
Modifier and TypeFieldDescriptionstatic final CmsSiteMatcher
Default matcher that always matches all other Site matchers. -
Constructor Summary
ConstructorDescriptionCmsSiteMatcher
(String serverString) Construct a new site matcher from a String which should be in default URL notation.CmsSiteMatcher
(String serverString, long timeOffset) Construct a new site matcher from a String which should be in default URL notation.CmsSiteMatcher
(String serverProtocol, String serverName, int serverPort) Constructs a new site matcher object.CmsSiteMatcher
(String serverProtocol, String serverName, int serverPort, long timeOffset) Constructs a new site matcher object. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this Objects instance.boolean
boolean
equalsIgnoreScheme
(CmsSiteMatcher matcher) Checks if this site matcher equals another site matcher, ignoring the scheme.forDifferentScheme
(String scheme) Generates a site matcher equivalent to this one but with a different scheme.Gets the redirect mode.Returns the hostname (e.g.int
Returns the port (e.g.Returns the protocol (e.g.long
Returns the time Offset.getUrl()
Returns the url of this site matcher.int
hashCode()
boolean
Is alias to be redirected?void
setRedirectMode
(CmsSiteMatcher.RedirectMode redirect) Set redirect.protected void
setServerName
(String serverName) Sets the hostname (e.g.protected void
setServerPort
(int serverPort) Sets the port (e.g.protected void
setServerProtocol
(String serverProtocol) Sets the protocol (e.g.protected void
setTimeOffset
(long timeOffset) Sets the time Offset in seconds.toString()
-
Field Details
-
DEFAULT_MATCHER
Default matcher that always matches all other Site matchers.
-
-
Constructor Details
-
CmsSiteMatcher
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
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:8080timeOffset
- the time offset
-
CmsSiteMatcher
Constructs a new site matcher object.- Parameters:
serverProtocol
- to protocol required to access this siteserverName
- the server URL prefix to which this site is mappedserverPort
- the port required to access this site
-
CmsSiteMatcher
Constructs a new site matcher object.- Parameters:
serverProtocol
- to protocol required to access this siteserverName
- the server URL prefix to which this site is mappedserverPort
- the port required to access this sitetimeOffset
- the time offset
-
-
Method Details
-
clone
Returns a clone of this Objects instance. -
equals
-
equalsIgnoreScheme
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
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
Returns the time Offset.- Returns:
- the time Offset
-
getUrl
Returns the url of this site matcher.- Returns:
- the url, i.e. {protocol}://{servername}[:{port}], port appened only if != 80
-
hashCode
-
isRedirect
Is alias to be redirected?- Returns:
- boolean
-
setRedirectMode
Set redirect.- Parameters:
redirect
- boolean
-
toString
-
setServerName
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
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
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
Sets the time Offset in seconds.- Parameters:
timeOffset
- the time Offset to set
-