public interface Mount
A Mount
object is the mount from a prefix to some (sub)site *or* content location: when the isMapped()
property returns true
or missing,
the Mount
is linked to a HstSite
that uses a HstSiteMap
. When isMapped()
property returns false
, the Mount
won't use
a URL mapping through the HstSiteMap
Mount
is a Composite pattern: Each Mount
can contain any descendant
child Mount
tree. A Mount
'lives' below a VirtualHost
. The Mount
directly below a VirtualHost
must be called hst:root by definition.
The hst:root
Mount
is where the Mount
matching starts. Once a virtual host is matched for the incoming HttpServletRequest
,
we inspect the request path (the path after the context path and before the query string) and try to match the request path as deep as possible to the Mount
tree: note that
we try to map to the best matching Mount
: This means, that 'exact' matching names have precedence over wildcard names
Mount
tree configuration:
+127.0.0.1 +hst:root - hst:mountpoint = /content/documents/myproject - hst:ismapped = true + subsite - hst:mountpoint = /content/documents/subsite - hst:ismapped = true
The configuration above means, that below the host 127.0.0.1 we have of course the mandatory Mount
hst:root
, and below it, we have
a Mount
subsite
. Every request path that starts with /subsite
will be mapped to 'subsite' Mount
, all other request path's that do not start with '/subsite'
resolve to the hst:root
item. While the request path does match the next
Mount
descendant in the tree, the matching is continued to descendant Mount
items. Thus, in the current example,
the request path /subsite/home
will return the Mount
with name 'subsite'.
VirtualHost
also has:
One extra is possible, hst:namedpipeline
, see below for an example.
Just as with the virtual hosts, properties are inherited by child Mount
items as long as they are not defined by themselves
+www.mycompany.com +hst:root - hst:mountpoint = /content/documents/myproject +sub.mycompany.com +hst:root - hst:mountpoint = /content/documents/subsiteOptionally, wildcard matching support can be implemented, where the wilcards can be used within the property values. For example:
Modifier and Type | Field and Description |
---|---|
static String |
LIVE_NAME
the string value that indicates 'live'
|
static String |
PREVIEW_NAME
the string value that indicates 'preview'
|
static String |
PROPERTY_NAME_MOUNT_PREFIX
the predefined property name prefix to indicates mount aliases
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsMultipleSchemes()
When this
Mount has a HstSite attached to it that contains a HstSiteMap with HstSiteMapItem 's that
have multiple schemes (http/https) or that have a different scheme than the getScheme() . |
String |
getAlias()
Returns the alias of this
Mount item. |
String |
getCanonicalContentPath()
Deprecated.
since 7.9.0 : returns same as
getContentPath() : Use getContentPath() instead |
org.onehippo.cms7.services.hst.Channel |
getChannel() |
<T extends ChannelInfo> |
getChannelInfo() |
String |
getChannelPath()
Deprecated.
since 5.0.0 (CMS 12). Use
getChannel().getChannelPath() instead |
Mount |
getChildMount(String name) |
List<Mount> |
getChildMounts() |
String |
getCmsLocation()
Deprecated.
since 7.9.1 : Use
getCmsLocations() instead |
List<String> |
getCmsLocations() |
String |
getContentPath()
Returns the content path for this
Mount object. |
String |
getContextPath()
Returns the contextpath (webapp) for this
Mount . |
String |
getDefaultResourceBundleId()
Deprecated.
since 2.28.00. Use
getDefaultResourceBundleIds() instead |
String[] |
getDefaultResourceBundleIds() |
String[] |
getDefaultSiteMapItemHandlerIds() |
String |
getFormLoginPage()
Returns FORM Login Page
|
String |
getHomePage() |
HstSite |
getHstSite() |
HstSiteMapMatcher |
getHstSiteMapMatcher()
This is a shortcut method fetching the HstSiteMapMatcher from the backing
HstManager |
String |
getIdentifier() |
String |
getLocale()
the locale for this
Mount or null when it does not contain one. |
String |
getMountPath()
Returns the mount path for this
Mount object. |
String |
getMountPoint()
Returns the mount point for this
Mount object. |
Map<String,String> |
getMountProperties()
Returns all the properties that start with "hst:mount" and have value of type
String . |
String |
getName() |
String |
getNamedPipeline()
|
String |
getPageNotFound() |
String |
getParameter(String name)
The String value of the mount parameter.
|
Map<String,String> |
getParameters()
Returns an unmodifiable map of all mount parameters, empty map if none.
|
Mount |
getParent() |
int |
getPort() |
String |
getProperty(String name)
the string value of the property or
null when the property is not present. |
List<String> |
getPropertyNames()
Returns the unmodifiable
List of all properties names and EMPTY list if no properties available. |
Set<String> |
getRoles()
Returns the roles that are allowed to access this Mount when
isAuthenticated() is true. |
String |
getScheme() |
int |
getSchemeNotMatchingResponseCode()
|
String |
getType() |
List<String> |
getTypes() |
Set<String> |
getUsers()
Returns the users that are allowed to access this Mount when
isAuthenticated() is true. |
VirtualHost |
getVirtualHost() |
boolean |
hasNoChannelInfo() |
boolean |
isAuthenticated()
If this method returns true, then only if the user is explicitly allowed or
servletRequest.isUserInRole(role) returns true this
Mount is accessible for the request. |
boolean |
isCacheable() |
boolean |
isContextPathInUrl() |
boolean |
isMapped()
|
boolean |
isOfType(String type)
|
boolean |
isPortInUrl() |
boolean |
isPreview()
This method returns the same as
isOfType(String type) with type="preview" |
boolean |
isSchemeAgnostic()
If a
Mount is scheme agnostic, the request gets served regardless whether it is http or
https (assuming HstSiteMapItem does not override the value) |
boolean |
isSessionStateful() |
boolean |
isSite()
Deprecated.
Since 4.0.0 (CMS 11.0.0)
|
boolean |
isSubjectBasedSession() |
boolean |
isVersionInPreviewHeader()
|
String |
onlyForContextPath()
Deprecated.
since CMS 7.9.1 : Use
getContextPath() instead |
static final String PROPERTY_NAME_MOUNT_PREFIX
static final String LIVE_NAME
static final String PREVIEW_NAME
String getAlias()
Mount
item. The alias of a Mount
must be unique in combination with every type getTypes()
within a single host group, also
see (VirtualHost.getHostGroupName()
). When there is no alias defined on the Mount
, null
is returned. The Mount
can then not be used
to lookup by aliasMount
item or null
when it does not have oneboolean isMapped()
Mount
is not using a HstSiteMap
for the request processing, this method returns false
. When it returns false
, then
getNamedPipeline()
should also be configured, and a pipeline should be invoked that is independent of the ResolvedSiteMapItem
as their won't be one.Mount getParent()
String getMountPoint()
Returns the mount point for this Mount
object. The mount point can be the absolute jcr path to the root site node, for example
something like '/hst:hst/hst:sites/mysite', but it can also be some jcr path to some virtual or canonical node in the repository. For example
it can be '/content/gallery' , which might be the case for a Mount suited for REST gallery calls.
Mount
and null
if there is no mountPoint configured (nor inherited)ResolvedMount.getResolvedMountPath()
boolean hasNoChannelInfo()
String getContentPath()
Returns the content path for this Mount
object. The content path is the absolute jcr path to the root site node content, for example
something like '/content/documents/myproject'. The content path can be the same as getMountPoint()
, but
this is in general only for Mount
's that have isMapped()
returning false. When the Mount
does have
isMapped()
equal to true, this method can return a different path than getMountPoint()
.
Mount
. It will be null
in case getMountPoint()
returns null
@Deprecated String getCanonicalContentPath()
getContentPath()
: Use getContentPath()
insteadMount
. Note that it returns in general the same
value as getContentPath()
Mount
.String getMountPath()
Returns the mount path for this Mount
object. The root Mount
(mount with no parent mount) has an empty String
("") as mount path. A mountPath for a
Mount
that is not a root Mount
is its own getName()
plus all ancestors until the root and always starts with a "/" (except for the root, this one is empty).
It can contain wildcards, for example /preview/*. Typically, these wildcards are replaced by their request specific values in the ResolvedMount
.
Note the difference with getMountPoint()
: the getMountPoint()
returns the jcr location of the (sub)site or of the content
Mount
ResolvedMount.getResolvedMountPath()
VirtualHost getVirtualHost()
Mount
belongs toHstSite getHstSite()
boolean isContextPathInUrl()
true
when the created url should have the contextpath in itboolean isPortInUrl()
true
when the created url should have contain the port number@Deprecated boolean isSite()
int getPort()
Mount
@Deprecated String onlyForContextPath()
getContextPath()
insteadString getContextPath()
Returns the contextpath (webapp) for this Mount
. A request can only be matched to this
Mount
if the request its HttpServletRequest.getContextPath()
is equal
to this contextpath, or when the Mount
returns null
for this contextpath: Namely
null
means the Mount
is contextpath (webapp) agnostic and can be matched regardless the
HttpServletRequest.getContextPath()
Mount
. The contextpath for the ROOT application must be an empty String.
If non-empty, a path starting with a "/" character but that does not end with a "/" character must be returned. If
null
is returned, the Mount
is contextpath (webapp) agnostic and can be matched regardless the
HttpServletRequest.getContextPath()
String getPageNotFound()
Mount
or null
when not presentString getScheme()
boolean isSchemeAgnostic()
Mount
is scheme agnostic, the request gets served regardless whether it is http
or
https
(assuming HstSiteMapItem
does not override the value)true
when this Mount
is scheme agnosticboolean containsMultipleSchemes()
Mount
has a HstSite
attached to it that contains a HstSiteMap
with HstSiteMapItem
's that
have multiple schemes (http/https) or that have a different scheme than the getScheme()
.true
when this Mount
can contain links with different schemesint getSchemeNotMatchingResponseCode()
the response code the HST sets when HttpServletRequest
scheme
does not match getScheme()
.
Default response code is HttpServletResponse.SC_MOVED_PERMANENTLY
. The following response
codes are supported and result in:
getScheme()
, permanent redirect to the correct scheme is donegetScheme()
, temporal redirect to the correct scheme is donegetScheme()
, a page forbidden is returnedgetScheme()
, a page not found is returned
Any other response code than above will result in inheriting the response code from parent Mount
or VirtualHost
boolean isPreview()
isOfType(String type)
with type="preview"
true
when this Mount
is configured to be a preview Mount.boolean isOfType(String type)
type
- the type to testtrue
when this Mount
is of type type
boolean isVersionInPreviewHeader()
Mount
has isPreview()
return false
, this method always returns false. When the Mount
is preview,
and the Mount
is configured to have the hst version number in preview, then this method returns true
true
when for this Mount
the current hst version should be added as a response headerString getNamedPipeline()
Mount
contains a namedPipeline, this value is inherited unless this Mount
explicitly defines its ownMount
or null
when the default pipeline is to be usedString getLocale()
Mount
or null
when it does not contain one. Note that if an ancestor Mount
contains a
locale, this value is inherited unless this Mount
explicitly defines its own. The root Mount
inherits the value from
the VirtualHost
if the virtual host contains a localeMount
or null
when it does not contain one.HstSiteMapMatcher getHstSiteMapMatcher()
HstManager
boolean isAuthenticated()
servletRequest.isUserInRole(role)
returns true
this
Mount is accessible for the request.
If a Mount does not have a configuration for authenticated, the value from the parent item is taken.true
if the Mount is authenticated.Set<String> getRoles()
isAuthenticated()
is true. If the Mount does not have any roles defined by itself, it
inherits them from the parent. If it defines roles, the roles from any ancestor are ignored. An empty set of roles
in combination with isAuthenticated()
return true
means nobody has access to the itemSet<String> getUsers()
isAuthenticated()
is true. If the Mount does not have any users defined by itself, it
inherits them from the parent. If it defines users, the users from any ancestor are ignored. An empty set of users
in combination with isAuthenticated()
return true
means nobody has access to the itemboolean isSubjectBasedSession()
boolean isSessionStateful()
String getFormLoginPage()
null
if not configuredString getProperty(String name)
null
when the property is not present. When the property value is not of
type String
, we'll return the Object.toString()
valuename
- the name of the propertynull
when the property is not presentList<String> getPropertyNames()
List
of all properties names and EMPTY list if no properties available. Through
getProperty(String)
the value of a property can be retrieved.List
of all properties names and EMPTY list if no properties availableMap<String,String> getMountProperties()
Returns all the properties that start with "hst:mount" and have value of type String
. This map has as key the
propertyname after "hst:mount".
Note The property called hst:mountpoint
is excluded from this map, as it has a complete different purpose
String getParameter(String name)
name
- the parameter namenull
if not presentMap<String,String> getParameters()
@Deprecated String getChannelPath()
getChannel().getChannelPath()
insteadnull
if not configured<T extends ChannelInfo> T getChannelInfo()
T
- Type of the channel info. Only checked at runtime on assignment.null
in case getChannel()
returns null
or
when the ChannelInfo
interface cannot be loaded by the current classLoaderorg.onehippo.cms7.services.hst.Channel getChannel()
String[] getDefaultSiteMapItemHandlerIds()
HstSiteMapItem
's get or null
if non configuredboolean isCacheable()
true
if rendering / resource requests can have their entire page http responses cached.@Deprecated String getDefaultResourceBundleId()
getDefaultResourceBundleIds()
insteadString[] getDefaultResourceBundleIds()
Mount
and empty from ancestor Mount
or when root host from VirtualHost.getDefaultResourceBundleIds()
@Deprecated String getCmsLocation()
getCmsLocations()
insteadnull
if not configuredCopyright © 2008–2017 Hippo B.V. (http://www.onehippo.com). All rights reserved.