public final class CmsSite extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable<CmsSite>, java.io.Serializable
| Modifier and Type | Class and Description |
|---|---|
static class |
CmsSite.LocalizationMode
The site localization modes.
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PARAM_LOCALIZATION_MODE
The localization mode parameter name.
|
static java.lang.String |
PARAM_MAIN_LOCALE
Parameter name for the main locale.
|
static java.lang.String |
PARAM_SECONDARY_LOCALES
Parameter name for the secondary locales.
|
| Constructor and Description |
|---|
CmsSite(java.lang.String siteRoot,
CmsSiteMatcher siteMatcher)
Constructs a new site object without title and id information,
this is to be used for lookup purposes only.
|
CmsSite(java.lang.String siteRoot,
CmsUUID siteRootUUID,
java.lang.String title)
Constructs a new site object with a default (wildcard) a site matcher,
this is to be used for display purposes only.
|
CmsSite(java.lang.String siteRoot,
CmsUUID siteRootUUID,
java.lang.String title,
CmsSiteMatcher siteMatcher,
java.lang.String position)
Constructs a new site object.
|
CmsSite(java.lang.String siteRoot,
CmsUUID siteRootUUID,
java.lang.String title,
CmsSiteMatcher siteMatcher,
java.lang.String position,
java.lang.String errorPage,
CmsSiteMatcher secureSite,
boolean exclusiveUrl,
boolean exclusiveError,
boolean webserver,
java.util.List<CmsSiteMatcher> aliases)
Constructs a new site object.
|
CmsSite(java.lang.String siteRoot,
java.lang.String siteURL)
Constructs a new site object without title and id information,
with a site matcher generated from the provided URL.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAlias(CmsSiteMatcher aliasServer)
Adds an alias for the site.
|
CmsSite |
clone()
Returns a clone of this Objects instance.
|
int |
compareTo(CmsSite that) |
boolean |
equals(java.lang.Object obj) |
java.util.List<CmsSiteMatcher> |
getAliases()
Returns the aliases for this site.
|
java.util.List<CmsSiteMatcher> |
getAllMatchers()
Gets all site matchers which should be used for matching the site.
|
java.lang.String |
getErrorPage()
Returns the errorPage.
|
CmsSite.LocalizationMode |
getLocalizationMode()
Returns the localization mode.
|
java.util.Locale |
getMainTranslationLocale(java.util.Locale defaultValue)
Gets the main translation locale for this site.
|
java.util.SortedMap<java.lang.String,java.lang.String> |
getParameters()
Returns the parameters.
|
float |
getPosition()
Returns the sorting position.
|
java.util.List<java.util.Locale> |
getSecondaryTranslationLocales()
Gets the list of secondary translation locales.
|
CmsSiteMatcher |
getSecureServer()
Returns the secureServer.
|
protected CmsSiteMatcher |
getSecureServerMatcher()
Returns the site matcher for the secure site, or null if no secure site is defined.
|
java.lang.String |
getSecureUrl()
Returns the secure server url of this site root.
|
java.lang.String |
getServerPrefix(CmsObject cms,
CmsResource resource)
Returns the server prefix for the given resource in this site, used to distinguish between
secure (https) and non-secure (http) sites.
|
java.lang.String |
getServerPrefix(CmsObject cms,
java.lang.String resourceName)
Returns the server prefix for the given resource in this site, used to distinguish between
secure (https) and non-secure (http) sites.
|
CmsSiteMatcher |
getSiteMatcher()
Returns the site matcher that describes the URL of this site.
|
java.lang.String |
getSitePath(java.lang.String rootPath)
Returns the site path for the given root path in case the root path
actually starts with this site root, or
null in case
the root path does not. |
java.lang.String |
getSiteRoot()
Returns the path of this site's root directory in the OpenCms VFS without tailing slash.
|
CmsUUID |
getSiteRootUUID()
Returns the UUID of this site's root directory in the OpenCms VFS.
|
CmsSSLMode |
getSSLMode()
Gets the SSLMode of the site.
|
java.lang.String |
getTitle()
Returns the display title of this site.
|
java.lang.String |
getUrl()
Returns the server url of this site root.
|
int |
hashCode() |
boolean |
hasSecureServer()
Returns true, if the site has a secure server.
|
boolean |
isExclusiveError()
Returns the exclusive error flag.
|
boolean |
isExclusiveUrl()
Returns the exclusive protocol flag.
|
boolean |
isOnlineUpdated()
Checks if the site it in the online project.
|
boolean |
isSharedSite()
Returns a flag indicating if the site is the shared site.
|
boolean |
isWebserver()
Returns the web server.
|
protected void |
setAliases(java.util.List<CmsSiteMatcher> aliases)
Sets the aliases for the site.
|
void |
setErrorPage(java.lang.String errorPage)
Sets the errorPage.
|
void |
setExclusiveError(boolean error)
Sets the exclusive error flag.
|
void |
setExclusiveUrl(boolean exclusive)
Sets the exclusive protocol flag.
|
void |
sethasOnlineUpdated(boolean isOnline)
Sets the online status.
|
void |
setParameters(java.util.SortedMap<java.lang.String,java.lang.String> parameters)
Sets the parameters.
|
protected void |
setPosition(float position)
Sets the display title of this site.
|
protected void |
setSecureServer(CmsSiteMatcher secureServer)
Sets the secure server.
|
protected void |
setSiteMatcher(CmsSiteMatcher siteMatcher)
Sets the site matcher that describes the URL of this site.
|
void |
setSiteRoot(java.lang.String siteRoot)
Sets the server URL prefix to which this site is mapped.
|
protected void |
setSiteRootUUID(CmsUUID siteRootUUID)
Sets the UUID of this site's root directory in the OpenCms VFS.
|
void |
setSSLMode(CmsSSLMode mode)
Sets the SSLMode of the site.
|
protected void |
setTitle(java.lang.String name)
Sets the display title of this site.
|
void |
setUsePermanentRedirects(boolean usePermanentRedirects)
Enables use of permanent redirects instead of temporary redirects to the secure site.
|
void |
setWebserver(boolean webserver)
Sets the web server.
|
java.lang.String |
toString() |
boolean |
usesPermanentRedirects()
Returns true if permanent redirects should be used for redirecting to the secure URL for this site.
|
public static final java.lang.String PARAM_LOCALIZATION_MODE
public static final java.lang.String PARAM_MAIN_LOCALE
public static final java.lang.String PARAM_SECONDARY_LOCALES
public CmsSite(java.lang.String siteRoot, CmsSiteMatcher siteMatcher)
siteRoot - root directory of this site in the OpenCms VFSsiteMatcher - the site matcher for this sitepublic CmsSite(java.lang.String siteRoot, CmsUUID siteRootUUID, java.lang.String title)
siteRoot - root directory of this site in the OpenCms VFSsiteRootUUID - UUID of this site's root directory in the OpenCms VFStitle - display name of this sitepublic CmsSite(java.lang.String siteRoot, CmsUUID siteRootUUID, java.lang.String title, CmsSiteMatcher siteMatcher, java.lang.String position)
siteRoot - root directory of this site in the OpenCms VFSsiteRootUUID - UUID of this site's root directory in the OpenCms VFStitle - display name of this sitesiteMatcher - the site matcher for this siteposition - the sorting positionpublic CmsSite(java.lang.String siteRoot, CmsUUID siteRootUUID, java.lang.String title, CmsSiteMatcher siteMatcher, java.lang.String position, java.lang.String errorPage, CmsSiteMatcher secureSite, boolean exclusiveUrl, boolean exclusiveError, boolean webserver, java.util.List<CmsSiteMatcher> aliases)
siteRoot - root directory of this site in the OpenCms VFSsiteRootUUID - UUID of this site's root directory in the OpenCms VFStitle - display name of this sitesiteMatcher - the site matcher for this siteposition - the sorting positionerrorPage - the optional error page for this sitesecureSite - the secure siteexclusiveUrl - the exclusive flagexclusiveError - the exclusive error flagwebserver - indicates whether to write the web server configuration for this site or notaliases - the aliasespublic CmsSite(java.lang.String siteRoot, java.lang.String siteURL)
This is to be used for test purposes only.
siteRoot - root directory of this site in the OpenCms VFSsiteURL - the URL to create the site matcher for this site frompublic CmsSite clone()
clone in class java.lang.Objectpublic int compareTo(CmsSite that)
compareTo in interface java.lang.Comparable<CmsSite>Comparable.compareTo(java.lang.Object)public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.util.List<CmsSiteMatcher> getAliases()
public java.util.List<CmsSiteMatcher> getAllMatchers()
public java.lang.String getErrorPage()
public CmsSite.LocalizationMode getLocalizationMode()
public java.util.Locale getMainTranslationLocale(java.util.Locale defaultValue)
defaultValue - the value to return as a default when no main translation locale is setpublic java.util.SortedMap<java.lang.String,java.lang.String> getParameters()
public float getPosition()
public java.util.List<java.util.Locale> getSecondaryTranslationLocales()
public CmsSiteMatcher getSecureServer()
public java.lang.String getSecureUrl()
public java.lang.String getServerPrefix(CmsObject cms, CmsResource resource)
This is required since a resource may have an individual "secure" setting using the property
CmsPropertyDefinition.PROPERTY_SECURE, which means this resource
must be delivered only using a secure protocol.
The result will look like http://site.enterprise.com:8080/ or https://site.enterprise.com/.
cms - the current users OpenCms contextresource - the resource to usegetServerPrefix(CmsObject, String)public java.lang.String getServerPrefix(CmsObject cms, java.lang.String resourceName)
This is required since a resource may have an individual "secure" setting using the property
CmsPropertyDefinition.PROPERTY_SECURE, which means this resource
must be delivered only using a secure protocol.
The result will look like http://site.enterprise.com:8080/ or https://site.enterprise.com/.
cms - the current users OpenCms contextresourceName - the resource namegetSecureUrl(),
getUrl()public CmsSiteMatcher getSiteMatcher()
public java.lang.String getSitePath(java.lang.String rootPath)
null in case
the root path does not.rootPath - the root path to get the site path fornull in case
the root path does notpublic java.lang.String getSiteRoot()
e.g. /sites/defaultpublic CmsUUID getSiteRootUUID()
public CmsSSLMode getSSLMode()
public java.lang.String getTitle()
public java.lang.String getUrl()
public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean hasSecureServer()
public boolean isExclusiveError()
true will generate a 404 error,
or false will redirect to secure url.public boolean isExclusiveUrl()
true secure resources will only be available using the configured secure url,
or false if the uri (protocol + servername) does not really matter.public boolean isOnlineUpdated()
public boolean isSharedSite()
true if the site is the shared site,
or false if it is not the shared site.public boolean isWebserver()
public void setErrorPage(java.lang.String errorPage)
errorPage - the errorPage to setpublic void setExclusiveError(boolean error)
error - the exclusive error flagpublic void setExclusiveUrl(boolean exclusive)
exclusive - the exclusive protocol flagpublic void sethasOnlineUpdated(boolean isOnline)
isOnline - true -> site has online versionpublic void setParameters(java.util.SortedMap<java.lang.String,java.lang.String> parameters)
parameters - the parameters to setpublic void setSiteRoot(java.lang.String siteRoot)
siteRoot - the server URL prefix to which this site is mappedpublic void setSSLMode(CmsSSLMode mode)
mode - the CmsSSLModepublic void setUsePermanentRedirects(boolean usePermanentRedirects)
usePermanentRedirects - true if permanent redirects should be usedpublic void setWebserver(boolean webserver)
webserver - the web server to setpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public boolean usesPermanentRedirects()
protected void addAlias(CmsSiteMatcher aliasServer)
aliasServer - the sitematcher for the aliasprotected CmsSiteMatcher getSecureServerMatcher()
protected void setAliases(java.util.List<CmsSiteMatcher> aliases)
aliases - the aliases for the siteprotected void setPosition(float position)
position - the display title of this siteprotected void setSecureServer(CmsSiteMatcher secureServer)
secureServer - the sitematcher of the secure serverprotected void setSiteMatcher(CmsSiteMatcher siteMatcher)
siteMatcher - the site matcher that describes the URL of this siteprotected void setSiteRootUUID(CmsUUID siteRootUUID)
siteRootUUID - the UUID of this site's root directory in the OpenCms VFSprotected void setTitle(java.lang.String name)
name - the display title of this site