Interface Mount
-
- All Known Subinterfaces:
ContextualizableMount
,MutableMount
public interface Mount
A
Mount
object is the mount from a prefix to some (sub)site *or* content location: when theisMapped()
property returnstrue
or missing, theMount
is linked to aHstSite
that uses aHstSiteMap
. WhenisMapped()
property returnsfalse
, theMount
won't use a URL mapping through theHstSiteMap
Mount
is a Composite pattern: EachMount
can contain any descendant childMount
tree. AMount
'lives' below aVirtualHost
. TheMount
directly below aVirtualHost
must be called hst:root by definition. Thehst:root
Mount
is where theMount
matching starts. Once a virtual host is matched for the incomingHttpServletRequest
, 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 theMount
tree: note that we try to map to the best matchingMount
: This means, that 'exact' matching names have precedence over wildcard namesMount
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
Also, you can configure some of the same properties theMount
hst:root
, and below it, we have aMount
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 thehst:root
item. While the request path does match the next
Mount
descendant in the tree, the matching is continued to descendantMount
items. Thus, in the current example, the request path/subsite/home
will return theMount
with name 'subsite'.VirtualHost
also has:- hst:port (long)
- hst:showcontextpath (boolean)
- hst:showport(boolean)
- hst:scheme (string)
One extra is possible,
hst:namedpipeline
, see below for an example.Just as with the virtual hosts, properties are inherited by child
Obviously, the above configuration might not be desirable in some circumstances, for example, when on a production host, you do not want a preview available at all. Configuration then for example could be: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/subsite
Optionally, wildcard matching support can be implemented, where the wilcards can be used within the property values. For example:
-
-
Field Summary
Fields Modifier and Type Field 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
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
containsMultipleSchemes()
When thisMount
has aHstSite
attached to it that contains aHstSiteMap
withHstSiteMapItem
's that have multiple schemes (http/https) or that have a different scheme than thegetScheme()
.String
getAlias()
Returns the alias of thisMount
item.Channel
getChannel()
<T extends ChannelInfo>
TgetChannelInfo()
Mount
getChildMount(String name)
List<Mount>
getChildMounts()
String
getContentPath()
Returns the content path for thisMount
object.String
getContextPath()
Returns the contextpath (webapp) for thisMount
.String[]
getDefaultResourceBundleIds()
String[]
getDefaultSiteMapItemHandlerIds()
String
getFormLoginPage()
Returns FORM Login PageString
getHomePage()
String
getHstLinkUrlPrefix()
Returns the 'Page Model API host' in case one is configured.HstSite
getHstSite()
HstSiteMapMatcher
getHstSiteMapMatcher()
This is a shortcut method fetching the HstSiteMapMatcher from the backingHstManager
String
getIdentifier()
String
getLocale()
the locale for thisMount
ornull
when it does not contain one.String
getMountPath()
Returns the mount path for thisMount
object.String
getMountPoint()
Returns the mount point for thisMount
object.Map<String,String>
getMountProperties()
Returns all the properties that start with "hst:mount" and have value of typeString
.String
getName()
String
getNamedPipeline()
String
getPageModelApi()
if non-null, the name of the autocreated PMA child mountString
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 ornull
when the property is not present.List<String>
getPropertyNames()
Returns the unmodifiableList
of all properties names and EMPTY list if no properties available.Map<String,String>
getResponseHeaders()
Return a non-null unmodifiable map of the configuration values of HTTP Response headers which should be set in any responses by the requests on this.Set<String>
getRoles()
Returns the roles that are allowed to access this Mount whenisAuthenticated()
is true.String
getScheme()
int
getSchemeNotMatchingResponseCode()
String
getType()
List<String>
getTypes()
Set<String>
getUsers()
Returns the users that are allowed to access this Mount whenisAuthenticated()
is true.VirtualHost
getVirtualHost()
boolean
hasNoChannelInfo()
boolean
isAuthenticated()
If this method returns true, then only if the user is explicitly allowed orservletRequest.isUserInRole(role)
returnstrue
this Mount is accessible for the request.boolean
isCacheable()
boolean
isContextPathInUrl()
boolean
isExplicit()
boolean
isFinalPipeline()
Expert: whenisFinalPipeline()
returnstrue
, it indicates that a matchedHstSiteMapItem
cannot override the configured pipeline.boolean
isMapped()
boolean
isOfType(String type)
boolean
isPortInUrl()
boolean
isPreview()
This method returns the same asisOfType(String type)
withtype="preview"
boolean
isSchemeAgnostic()
If aMount
is scheme agnostic, the request gets served regardless whether it ishttp
orhttps
(assumingHstSiteMapItem
does not override the value)boolean
isSessionStateful()
boolean
isSubjectBasedSession()
boolean
isVersionInPreviewHeader()
-
-
-
Field Detail
-
PROPERTY_NAME_MOUNT_PREFIX
static final String PROPERTY_NAME_MOUNT_PREFIX
the predefined property name prefix to indicates mount aliases- See Also:
- Constant Field Values
-
LIVE_NAME
static final String LIVE_NAME
the string value that indicates 'live'- See Also:
- Constant Field Values
-
PREVIEW_NAME
static final String PREVIEW_NAME
the string value that indicates 'preview'- See Also:
- Constant Field Values
-
-
Method Detail
-
getAlias
String getAlias()
Returns the alias of thisMount
item. The alias of aMount
must be unique in combination with every typegetTypes()
within a single host group, also see (VirtualHost.getHostGroupName()
). When there is no alias defined on theMount
,null
is returned. TheMount
can then not be used to lookup by alias- Returns:
- The alias of this
Mount
item ornull
when it does not have one
-
isMapped
boolean isMapped()
When thisMount
is not using aHstSiteMap
for the request processing, this method returnsfalse
. When it returnsfalse
, thengetNamedPipeline()
should also be configured, and a pipeline should be invoked that is independent of theResolvedSiteMapItem
as their won't be one.
-
getParent
Mount getParent()
-
getMountPoint
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.- Returns:
- the mountPoint for this
Mount
andnull
if there is no mountPoint configured (nor inherited) - See Also:
ResolvedMount.getResolvedMountPath()
-
hasNoChannelInfo
boolean hasNoChannelInfo()
-
getContentPath
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 asgetMountPoint()
, but this is in general only forMount
's that haveisMapped()
returning false. When theMount
does haveisMapped()
equal to true, this method can return a different path thangetMountPoint()
.- Returns:
- the content path for this
Mount
. It will benull
in casegetMountPoint()
returnsnull
-
getMountPath
String getMountPath()
Returns the mount path for this
Mount
object. The rootMount
(mount with no parent mount) has an emptyString
("") as mount path. A mountPath for aMount
that is not a rootMount
is its owngetName()
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 theResolvedMount
.Note the difference with
getMountPoint()
: thegetMountPoint()
returns the jcr location of the (sub)site or of the content- Returns:
- the mountPath for this
Mount
- See Also:
ResolvedMount.getResolvedMountPath()
-
getVirtualHost
VirtualHost getVirtualHost()
- Returns:
- the virtualHost where this
Mount
belongs to
-
getHstSite
HstSite getHstSite()
-
isContextPathInUrl
boolean isContextPathInUrl()
- Returns:
true
when the created url should have the contextpath in it
-
isPortInUrl
boolean isPortInUrl()
- Returns:
true
when the created url should have contain the port number
-
getPort
int getPort()
- Returns:
- the portnumber for this
Mount
-
getContextPath
String getContextPath()
Returns the contextpath (webapp) for this
Mount
.- Returns:
- the contextpath (webapp) for this
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. This method never returnsnull
-
getPageNotFound
String getPageNotFound()
- Returns:
- the pagenotfound for this
Mount
ornull
when not present
-
getScheme
String getScheme()
- Returns:
- the scheme to use for creating external urls, for example http / https
-
getHstLinkUrlPrefix
String getHstLinkUrlPrefix()
Returns the 'Page Model API host' in case one is configured. In case non is configured, the one from the parent
Mount
is used and if no parent present, the one fromVirtualHost.getHstLinkUrlPrefix()
is used. If no valid configuration present,null
is returned- Returns:
- the baseURL for created link and
null
if not configured
-
isSchemeAgnostic
boolean isSchemeAgnostic()
If aMount
is scheme agnostic, the request gets served regardless whether it ishttp
orhttps
(assumingHstSiteMapItem
does not override the value)- Returns:
true
when thisMount
is scheme agnostic
-
containsMultipleSchemes
boolean containsMultipleSchemes()
When thisMount
has aHstSite
attached to it that contains aHstSiteMap
withHstSiteMapItem
's that have multiple schemes (http/https) or that have a different scheme than thegetScheme()
.- Returns:
true
when thisMount
can contain links with different schemes
-
getSchemeNotMatchingResponseCode
int getSchemeNotMatchingResponseCode()
the response code the HST sets when
HttpServletRequest
scheme
does not matchgetScheme()
. Default response code isHttpServletResponse.SC_MOVED_PERMANENTLY
. The following response codes are supported and result in:- 200 : no behavior, ignored
- 301 : when request has different scheme than
getScheme()
, permanent redirect to the correct scheme is done - 302 | 303 | 307 : when request has different scheme than
getScheme()
, temporal redirect to the correct scheme is done - 403 : when request has different scheme than
getScheme()
, a page forbidden is returned - 404 : when request has different scheme than
getScheme()
, a page not found is returned
Any other response code than above will result in inheriting the response code from parent
Mount
orVirtualHost
-
isPreview
boolean isPreview()
This method returns the same asisOfType(String type)
withtype="preview"
- Returns:
true
when thisMount
is configured to be a preview Mount.
-
isOfType
boolean isOfType(String type)
- Parameters:
type
- the type to test- Returns:
true
when thisMount
is of typetype
-
isVersionInPreviewHeader
boolean isVersionInPreviewHeader()
When thisMount
hasisPreview()
returnfalse
, this method always returns false. When theMount
is preview, and theMount
is configured to have the hst version number in preview, then this method returnstrue
- Returns:
true
when for thisMount
the current hst version should be added as a response header
-
getNamedPipeline
String getNamedPipeline()
Note that if an ancestorMount
contains a namedPipeline, this value is inherited unless thisMount
explicitly defines its own- Returns:
- the named pipeline to be used for this
Mount
ornull
when the default pipeline is to be used
-
isFinalPipeline
boolean isFinalPipeline()
Expert: when
isFinalPipeline()
returnstrue
, it indicates that a matchedHstSiteMapItem
cannot override the configured pipeline. Typically this is useful in case for example the mount is configured to be some 'rest representation'. In that case, you do not want a site map item to configure a pipeline that doesn't render a rest representation at all. In general, for normal site development,isFinalPipeline()
returns false.Note that final only applies to the site map items that might have a different explicitly configured pipeline which then gets ignored. If this
Mount
has a childMount
,the childMount
can have a different pipeline value (and can be non-final)- Returns:
true
indicates that a specific value for the named pipeline on aHstSiteMapItem
is ignored
-
getLocale
String getLocale()
the locale for thisMount
ornull
when it does not contain one. Note that if an ancestorMount
contains a locale, this value is inherited unless thisMount
explicitly defines its own. The rootMount
inherits the value from theVirtualHost
if the virtual host contains a locale- Returns:
- the locale for this
Mount
ornull
when it does not contain one.
-
getHstSiteMapMatcher
HstSiteMapMatcher getHstSiteMapMatcher()
This is a shortcut method fetching the HstSiteMapMatcher from the backingHstManager
- Returns:
- the HstSiteMapMatcher implementation
-
isAuthenticated
boolean isAuthenticated()
If this method returns true, then only if the user is explicitly allowed orservletRequest.isUserInRole(role)
returnstrue
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.- Returns:
true
if the Mount is authenticated.
-
getRoles
Set<String> getRoles()
Returns the roles that are allowed to access this Mount whenisAuthenticated()
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 withisAuthenticated()
returntrue
means nobody has access to the item- Returns:
- The set of roles that are allowed to access this Mount. When no roles defined, the roles from the parent item are inherited. If none of the parent items have a role defined, an empty set is returned
-
getUsers
Set<String> getUsers()
Returns the users that are allowed to access this Mount whenisAuthenticated()
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 withisAuthenticated()
returntrue
means nobody has access to the item- Returns:
- The set of users that are allowed to access this Mount. When no users defined, the users from the parent item are inherited. If none of the parent items have a user defined, an empty set is returned
-
isSubjectBasedSession
boolean isSubjectBasedSession()
- Returns:
- Returns true if subject based jcr session should be used for this Mount
-
isSessionStateful
boolean isSessionStateful()
- Returns:
- Returns true if subject based jcr session should be statefully managed.
-
getFormLoginPage
String getFormLoginPage()
Returns FORM Login Page- Returns:
- the FORM Login Page and
null
if not configured
-
getProperty
String getProperty(String name)
the string value of the property ornull
when the property is not present. When the property value is not of typeString
, we'll return theObject.toString()
value- Parameters:
name
- the name of the property- Returns:
- the value of the property or
null
when the property is not present
-
getPropertyNames
List<String> getPropertyNames()
Returns the unmodifiableList
of all properties names and EMPTY list if no properties available. ThroughgetProperty(String)
the value of a property can be retrieved.- Returns:
- the unmodifiable
List
of all properties names and EMPTY list if no properties available
-
getMountProperties
Map<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- Returns:
- all the mount properties and an empty map if there where no mount properties
-
getParameter
String getParameter(String name)
The String value of the mount parameter.- Parameters:
name
- the parameter name- Returns:
- the parameter value,
null
if not present
-
getParameters
Map<String,String> getParameters()
Returns an unmodifiable map of all mount parameters, empty map if none.- Returns:
- map of all mount parameters
-
getChannelInfo
<T extends ChannelInfo> T getChannelInfo()
- Type Parameters:
T
- Type of the channel info. Only checked at runtime on assignment.- Returns:
- A channel properties instance or
null
in casegetChannel()
returnsnull
or when theChannelInfo
interface cannot be loaded by the current classLoader
-
getChannel
Channel getChannel()
-
getDefaultSiteMapItemHandlerIds
String[] getDefaultSiteMapItemHandlerIds()
- Returns:
- the String[] of defaultSiteMapItemHandlerIds which all
HstSiteMapItem
's get ornull
if non configured
-
isCacheable
boolean isCacheable()
- Returns:
true
if rendering / resource requests can have their entire page http responses cached.
-
getDefaultResourceBundleIds
String[] getDefaultResourceBundleIds()
- Returns:
- default resource bundle IDs for all sites below this mount to use, for example, { "org.example.resources.MyResources" }. Returns an empty array
when not configured on this
Mount
and empty from ancestorMount
or when root host fromVirtualHost.getDefaultResourceBundleIds()
-
getResponseHeaders
Map<String,String> getResponseHeaders()
Return a non-null unmodifiable map of the configuration values of HTTP Response headers which should be set in any responses by the requests on this. They keys from the returned map are the header names.
Note that the header names returned by this method overwrites any already set headers during request processing with the same name
- Returns:
- a non-null unmodifiable map of the configuration values of HTTP Response headers which should be set in any responses by the requests on this.
-
isExplicit
boolean isExplicit()
- Returns:
true
if the configuration behind thisMount
is explicitly configured. It returnsfalse
forMount
objects that are an implicit result, for example when theMount
is auto-created via Spring wiring. Note that auto created mounts that decorate or wrap an explicit mount might choose to returntrue
forisExplicit()
, thustrue
does not perse mean that theMount
instance is not a runtime createdMount
or not.
-
getPageModelApi
String getPageModelApi()
if non-null, the name of the autocreated PMA child mount
-
-