Class CmsSite
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<CmsSite>
- Since:
- 6.0.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The site localization modes. -
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new site object without title and id information, with a site matcher generated from the provided URL.CmsSite
(String siteRoot, CmsSiteMatcher siteMatcher) Constructs a new site object without title and id information, this is to be used for lookup purposes only.Constructs a new site object with a default (wildcard) a site matcher, this is to be used for display purposes only.CmsSite
(String siteRoot, CmsUUID siteRootUUID, String title, CmsSiteMatcher siteMatcher, String position) Constructs a new site object.CmsSite
(String siteRoot, CmsUUID siteRootUUID, String title, CmsSiteMatcher siteMatcher, String position, String errorPage, CmsSiteMatcher secureSite, boolean exclusiveUrl, boolean exclusiveError, boolean webserver, List<CmsSiteMatcher> aliases, boolean subsiteSelection) Constructs a new site object. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAlias
(CmsSiteMatcher aliasServer) Adds an alias for the site.clone()
Returns a clone of this Objects instance.int
Creates a generated site for the extension folder configured on this site, or null if no extension folder is set.boolean
Returns the aliases for this site.Gets all site matchers which should be used for matching the site.Gets the (optional) alternative site root mapping.Returns the errorPage.Returns the localization mode.getMainTranslationLocale
(Locale defaultValue) Gets the main translation locale for this site.Returns the parameters.float
Returns the sorting position.Gets the list of secondary translation locales.Returns the secureServer.protected CmsSiteMatcher
Returns the site matcher for the secure site, or null if no secure site is defined.Returns the secure server url of this site root.getServerPrefix
(CmsObject cms, String resourceName) Returns the server prefix for the given resource in this site, used to distinguish between secure (https) and non-secure (http) sites.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.Returns the site matcher that describes the URL of this site.getSitePath
(String rootPath) Returns the site path for the given root path in case the root path actually starts with this site root, ornull
in case the root path does not.Returns the path of this site's root directory in the OpenCms VFS without tailing slash.Returns the UUID of this site's root directory in the OpenCms VFS.Gets the SSLMode of the site.getTitle()
Returns the display title of this site.Returns all configured translation locales for this site.getUrl()
Returns the server url of this site root.int
hashCode()
boolean
Returns true, if the site has a secure server.boolean
Returns the exclusive error flag.boolean
Returns the exclusive protocol flag.boolean
Returns true if this is an automatically generated site (and thus should not be used in the site management UI).boolean
Checks if the site it in the online project.boolean
Returns a flag indicating if the site is the shared site.boolean
Returns true if subsite selection is enabled for this site.boolean
Returns the web server.boolean
Returns true if there is an alternative site root mapping configured for this site, and it matches the given path.protected void
setAliases
(List<CmsSiteMatcher> aliases) Sets the aliases for the site.void
setAlternativeSiteRootMapping
(Optional<CmsAlternativeSiteRootMapping> alternativeSiteRootMapping) Sets the alternative site root mapping.void
setErrorPage
(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
(SortedMap<String, 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
(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.void
setSubsiteSelectionEnabled
(boolean enabled) Enables / disables subsite selection for this site.protected void
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.toString()
boolean
Returns true if permanent redirects should be used for redirecting to the secure URL for this site.
-
Field Details
-
PARAM_LOCALIZATION_MODE
The localization mode parameter name.- See Also:
-
PARAM_MAIN_LOCALE
Parameter name for the main locale.- See Also:
-
PARAM_SECONDARY_LOCALES
Parameter name for the secondary locales.- See Also:
-
-
Constructor Details
-
CmsSite
Constructs a new site object without title and id information, this is to be used for lookup purposes only.- Parameters:
siteRoot
- root directory of this site in the OpenCms VFSsiteMatcher
- the site matcher for this site
-
CmsSite
Constructs a new site object with a default (wildcard) a site matcher, this is to be used for display purposes only.- Parameters:
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 site
-
CmsSite
public CmsSite(String siteRoot, CmsUUID siteRootUUID, String title, CmsSiteMatcher siteMatcher, String position) Constructs a new site object.- Parameters:
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 position
-
CmsSite
public CmsSite(String siteRoot, CmsUUID siteRootUUID, String title, CmsSiteMatcher siteMatcher, String position, String errorPage, CmsSiteMatcher secureSite, boolean exclusiveUrl, boolean exclusiveError, boolean webserver, List<CmsSiteMatcher> aliases, boolean subsiteSelection) Constructs a new site object.- Parameters:
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 aliasessubsiteSelection
- enable/disable subsite selection for this site
-
CmsSite
Constructs a new site object without title and id information, with a site matcher generated from the provided URL.This is to be used for test purposes only.
- Parameters:
siteRoot
- root directory of this site in the OpenCms VFSsiteURL
- the URL to create the site matcher for this site from
-
-
Method Details
-
clone
Returns a clone of this Objects instance. -
compareTo
- Specified by:
compareTo
in interfaceComparable<CmsSite>
- See Also:
-
createAlternativeSiteRootSite
Creates a generated site for the extension folder configured on this site, or null if no extension folder is set.- Returns:
- the generated site for the extension folder
-
equals
-
getAliases
Returns the aliases for this site.- Returns:
- a ArrayList with the aliases
-
getAllMatchers
Gets all site matchers which should be used for matching the site.- Returns:
- all site matchers to be used for matching the site
-
getAlternativeSiteRootMapping
Gets the (optional) alternative site root mapping.- Returns:
- the alternative site root mapping
-
getErrorPage
Returns the errorPage.- Returns:
- the errorPage
-
getLocalizationMode
Returns the localization mode.- Returns:
- the localization mode
-
getMainTranslationLocale
Gets the main translation locale for this site.- Parameters:
defaultValue
- the value to return as a default when no main translation locale is set- Returns:
- the main translation locale
-
getParameters
Returns the parameters.- Returns:
- the parameters
-
getPosition
Returns the sorting position.- Returns:
- the sorting position
-
getSecondaryTranslationLocales
Gets the list of secondary translation locales.- Returns:
- the list of secondary translation locales
-
getSecureServer
Returns the secureServer.- Returns:
- the secureServer
-
getSecureUrl
Returns the secure server url of this site root.- Returns:
- the secure server url
-
getServerPrefix
Returns the server prefix for the given resource in this site, used to distinguish between secure (https) and non-secure (http) sites.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/
orhttps://site.enterprise.com/
.- Parameters:
cms
- the current users OpenCms contextresource
- the resource to use- Returns:
- the server prefix for the given resource in this site
- See Also:
-
getServerPrefix
Returns the server prefix for the given resource in this site, used to distinguish between secure (https) and non-secure (http) sites.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/
orhttps://site.enterprise.com/
.- Parameters:
cms
- the current users OpenCms contextresourceName
- the resource name- Returns:
- the server prefix for the given resource in this site
- See Also:
-
getSiteMatcher
Returns the site matcher that describes the URL of this site.- Returns:
- the site matcher that describes the URL of this site
-
getSitePath
Returns the site path for the given root path in case the root path actually starts with this site root, ornull
in case the root path does not.- Parameters:
rootPath
- the root path to get the site path for- 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
-
getSiteRoot
Returns the path of this site's root directory in the OpenCms VFS without tailing slash.e.g. /sites/default
- Returns:
- the path of this site's root directory in the OpenCms VFS without tailing slash
-
getSiteRootUUID
Returns the UUID of this site's root directory in the OpenCms VFS.- Returns:
- the UUID of this site's root directory in the OpenCms VFS
-
getSSLMode
Gets the SSLMode of the site.- Returns:
- CmsSSLMode
-
getTitle
Returns the display title of this site.- Returns:
- the display title of this site
-
getTranslationLocales
Returns all configured translation locales for this site.The first entry in the list will be the main translation locale. If the main translation locale is not correctly configured, an empty list is returned.
- Returns:
- all configured translation locales for this site
-
getUrl
Returns the server url of this site root.- Returns:
- the server url
-
hashCode
-
hasSecureServer
Returns true, if the site has a secure server.- Returns:
- true, if the site has a secure server
-
isExclusiveError
Returns the exclusive error flag.- Returns:
true
will generate a 404 error, orfalse
will redirect to secure url.
-
isExclusiveUrl
Returns the exclusive protocol flag.- Returns:
true
secure resources will only be available using the configured secure url, orfalse
if the uri (protocol + servername) does not really matter.
-
isGenerated
Returns true if this is an automatically generated site (and thus should not be used in the site management UI).- Returns:
- true if this is a generated site
-
isOnlineUpdated
Checks if the site it in the online project.- Returns:
- true if it is in online project
-
isSubsiteSelectionEnabled
Returns true if subsite selection is enabled for this site.- Returns:
- true if subsite selection is enabled for this site
-
isWebserver
Returns the web server.- Returns:
- the web server
-
matchAlternativeSiteRoot
Returns true if there is an alternative site root mapping configured for this site, and it matches the given path.- Parameters:
path
- the path from the request- Returns:
- true if the alternative site root mapping matches the path
-
setAlternativeSiteRootMapping
public void setAlternativeSiteRootMapping(Optional<CmsAlternativeSiteRootMapping> alternativeSiteRootMapping) Sets the alternative site root mapping.- Parameters:
alternativeSiteRootMapping
- the alternative site root mapping
-
setErrorPage
Sets the errorPage.- Parameters:
errorPage
- the errorPage to set
-
setExclusiveError
Sets the exclusive error flag.- Parameters:
error
- the exclusive error flag
-
setExclusiveUrl
Sets the exclusive protocol flag.- Parameters:
exclusive
- the exclusive protocol flag
-
sethasOnlineUpdated
Sets the online status.- Parameters:
isOnline
- true -> site has online version
-
setParameters
Sets the parameters.- Parameters:
parameters
- the parameters to set
-
setSiteRoot
Sets the server URL prefix to which this site is mapped.- Parameters:
siteRoot
- the server URL prefix to which this site is mapped
-
setSSLMode
Sets the SSLMode of the site.- Parameters:
mode
- the CmsSSLMode
-
setSubsiteSelectionEnabled
Enables / disables subsite selection for this site.- Parameters:
enabled
- true if subsite selection should be enabled
-
setUsePermanentRedirects
Enables use of permanent redirects instead of temporary redirects to the secure site.- Parameters:
usePermanentRedirects
- true if permanent redirects should be used
-
setWebserver
Sets the web server.- Parameters:
webserver
- the web server to set
-
toString
-
usesPermanentRedirects
Returns true if permanent redirects should be used for redirecting to the secure URL for this site.- Returns:
- true if permanent redirects should be used
-
addAlias
Adds an alias for the site.- Parameters:
aliasServer
- the sitematcher for the alias
-
getSecureServerMatcher
Returns the site matcher for the secure site, or null if no secure site is defined.- Returns:
- the site matcher for the secure site
-
setAliases
Sets the aliases for the site.- Parameters:
aliases
- the aliases for the site
-
setPosition
Sets the display title of this site.- Parameters:
position
- the display title of this site
-
setSecureServer
Sets the secure server.- Parameters:
secureServer
- the sitematcher of the secure server
-
setSiteMatcher
Sets the site matcher that describes the URL of this site.- Parameters:
siteMatcher
- the site matcher that describes the URL of this site
-
setSiteRootUUID
Sets the UUID of this site's root directory in the OpenCms VFS.- Parameters:
siteRootUUID
- the UUID of this site's root directory in the OpenCms VFS
-
setTitle
Sets the display title of this site.- Parameters:
name
- the display title of this site
-