|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.site.CmsSiteManager
Manages all configured sites in OpenCms.
Constructor Summary | |
CmsSiteManager()
Creates a new CmsSiteManager. |
Method Summary | |
void |
addAliasToConfigSite(java.lang.String alias)
Adds an alias to the currently configured site. |
void |
addSite(java.lang.String server,
java.lang.String uri,
java.lang.String secureServer,
java.lang.String exclusive,
java.lang.String error)
Adds a new CmsSite to the list of configured sites, this is only allowed during configuration. |
static java.util.List |
getAvailableSites(CmsObject cms,
boolean workplaceMode)
Returns a list of all site available for the current user. |
static CmsSite |
getCurrentSite(CmsObject cms)
Returns the current site for the provided cms context object. |
CmsSite |
getDefaultSite()
Returns the default site. |
java.lang.String |
getDefaultUri()
Returns the defaultUri. |
static CmsSite |
getSite(java.lang.String siteRoot)
Returns the site with has the provided site root path, or null if no configured site has that root path. |
static java.lang.String |
getSiteRoot(java.lang.String path)
Returns the site root part of the resources root path, or null if the path does not match any site root. |
java.util.Set |
getSiteRoots()
Returns an unmodifiable set of all configured site roots (Strings). |
java.util.Map |
getSites()
Returns a map of configured sites. |
java.lang.String |
getWorkplaceServer()
Returns the workplace server. |
CmsSiteMatcher |
getWorkplaceSiteMatcher()
Returns the site matcher that matches the workplace site. |
void |
initialize(CmsObject cms)
Initializes the site manager with the OpenCms system configuration. |
boolean |
isMatching(CmsSiteMatcher matcher)
Returns true if the given site matcher matches a site. |
boolean |
isMatchingCurrentSite(CmsObject cms,
CmsSiteMatcher matcher)
Returns if the given site matcher matches the current site. |
boolean |
isWorkplaceRequest(javax.servlet.http.HttpServletRequest req)
Returns true if the given request is against the configured OpenCms workplace. |
CmsSite |
matchRequest(javax.servlet.http.HttpServletRequest req)
Matches the given request against all configures sites and returns the matching site, or the default site if no sites matches. |
CmsSite |
matchSite(CmsSiteMatcher matcher)
Return the site that matches the given site matcher, or the default site if no sites matches. |
void |
setDefaultUri(java.lang.String defaultUri)
Sets the default uri, this is only allowed during configuration. |
void |
setWorkplaceServer(java.lang.String workplaceServer)
Sets the workplace server, this is only allowed during configuration. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CmsSiteManager()
Method Detail |
public static java.util.List getAvailableSites(CmsObject cms, boolean workplaceMode)
cms
- the current cms contextworkplaceMode
- if true, the root and current site is included for the admin user
and the view permission is required to see the site root
public static CmsSite getCurrentSite(CmsObject cms)
cms
- the cms context object to check for the site
public static CmsSite getSite(java.lang.String siteRoot)
siteRoot
- the root path to look up the site for
public static java.lang.String getSiteRoot(java.lang.String path)
path
- the root path of a resource
public void addAliasToConfigSite(java.lang.String alias)
alias
- the url of the alias serverpublic void addSite(java.lang.String server, java.lang.String uri, java.lang.String secureServer, java.lang.String exclusive, java.lang.String error) throws CmsConfigurationException
If this method is called after the configuration is finished,
a RuntimeException
is thrown.
server
- the Serveruri
- the vfs pathsecureServer
- a secure server, can be null
exclusive
- if set to true
, secure resources will only be available using the configured secure urlerror
- if exclusive, and set to true
will generate a 404 error,
if set to false
will redirect to secure url
CmsConfigurationException
- if the site contains a servername, that is already assignedpublic CmsSite getDefaultSite()
public java.lang.String getDefaultUri()
public java.util.Set getSiteRoots()
public java.util.Map getSites()
The map uses CmsSiteMatcher objects as key and CmsSite as value.
public java.lang.String getWorkplaceServer()
public CmsSiteMatcher getWorkplaceSiteMatcher()
public void initialize(CmsObject cms)
cms
- an OpenCms context object that must have been initialized with "Admin" permissionspublic boolean isMatching(CmsSiteMatcher matcher)
matcher
- the site matcher to match the site with
public boolean isMatchingCurrentSite(CmsObject cms, CmsSiteMatcher matcher)
cms
- the cms objectmatcher
- the site matcher to match the site with
public boolean isWorkplaceRequest(javax.servlet.http.HttpServletRequest req)
true
if the given request is against the configured OpenCms workplace.
req
- the request to match
true
if the given request is against the configured OpenCms workplacepublic CmsSite matchRequest(javax.servlet.http.HttpServletRequest req)
req
- the request to match
public CmsSite matchSite(CmsSiteMatcher matcher)
matcher
- the site matcher to match the site with
public void setDefaultUri(java.lang.String defaultUri)
If this method is called after the configuration is finished,
a RuntimeException
is thrown.
defaultUri
- the defaultUri to setpublic void setWorkplaceServer(java.lang.String workplaceServer)
If this method is called after the configuration is finished,
a RuntimeException
is thrown.
workplaceServer
- the workplace server to set
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |