Interface HstSiteMapItem
- All Known Subinterfaces:
InternalHstSiteMapItem
HstSiteMapItem is used as a representation of a logical path (element) for matching (part of a)
external URL to a repository content location. Through its id it can be directly accessed by the HstSiteMap
,
to for example create a link to it. Obviously, creating a link to a HstSiteMapItem
does only make sense
when its path in the HstSiteMap
does not contain WILDCARD's ( *
or **
)
NOTE: As HstComponent
instances can access HstSiteMapItem
instances but should not be able to
modify them, implementations must make sure that through the api a HstSiteMapItem
instance cannot be
changed. Returned List and Map should be therefor unmodifiable.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
Expert: ThegetApplicationId()
is useful in case multiple application types are being served by a singleMount
.Returns aList
of all childHstSiteMapItem
's of thisHstSiteMapItem
.If a HstSiteMapItem can be used to resolve a url, it must have a componentConfigurationId referencing the component configuration the will handle the request processing.int
AHstSiteMapItem
can specify an error-code.Return theHstSiteMap
that is the container of thisHstSiteMapItem
getId()
The id of aHstSiteMapItem
is mandatory and must be unique within its containing
becauseHstSiteMap
must uniquely return aHstSiteMap.getSiteMapItemById(String)
HstSiteMapItem
.the locale for this sitemapItem ornull
when it does not contain one.getLocalParameter
(String name) seegetParameter(String)
, only this method returns parameters without inheritanceseegetParameters()
, only this method returns parameters (unmodifiable map) without inheritancethe namedPipeline for this sitemapItem ornull
when it does not contain one.getParameter
(String name) A HstSiteMapItem can contain a Map of parameters.SeegetParameter(String)
, only now entire the parameters map is returned.Returns parentHstSiteMapItem
andnull
when the item does not have a parent (in other words, it is a rootHstSiteMapItem
)The qualified id, which might contain more info then justgetId()
as the getId might return an id which is meaningfull only within it's currentHstSiteMap
getRefId()
The refId of aHstSiteMapItem
is non-mandatory and must be unique within its containing
becauseHstSiteMap
must uniquely return aHstSiteMap.getSiteMapItemByRefId(String)
HstSiteMapItem
.This method returns a content path, relative to theMount.getContentPath()
.String[]
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.getRoles()
Returns the roles that are allowed to access this sitemap item whenisAuthenticated()
is true.The scheme of a site map item specifies which scheme is to be used for serving this site map item.int
getSiteMapItemHandlerConfiguration
(String handlerId) Deprecated.since 13.0.0.Deprecated.since 13.0.0.int
AHstSiteMapItem
can specify the status-code that needs to be set on the webpage header.getUsers()
Returns the users that are allowed to access this sitemap item whenisAuthenticated()
is true.getValue()
Returns the logical path element of thisSiteMapItem
.boolean
isAny()
Returns a boolean indicating whether thisHstSiteMapItem
represents a path with aany
value**
boolean
If this method returns true, then only if the user is explicitly allowed orservletRequest.isUserInRole(role)
returnstrue
this sitemap item is accessible for the request.boolean
boolean
A sitemap item that should serve (a) container resource(s) can be marked to do so by returningtrue
fromisContainerResource()
.boolean
When having more sitemapitem as siblings, for example foo.xml, foo.html and foo.rss, you might not want all three being used for linkrewriting: Even worse, if they all three have the samegetRelativeContentPath()
, we cannot choose which one is the one you want, so, one of the items is used.boolean
boolean
boolean
boolean
Returnstrue
when thisHstSiteMapItem
is marked as deleted.boolean
If aHstSiteMapItem
is scheme agnostic, the request gets served regardless whether it ishttp
orhttps
boolean
Returns a boolean indicating whether thisHstSiteMapItem
represents a path with awildcard
value*
-
Method Details
-
getId
String getId()The id of aHstSiteMapItem
is mandatory and must be unique within its containing
becauseHstSiteMap
must uniquely return aHstSiteMap.getSiteMapItemById(String)
HstSiteMapItem
.- Returns:
- the id of this HstSiteMapItem
-
getRefId
String getRefId()The refId of aHstSiteMapItem
is non-mandatory and must be unique within its containing
becauseHstSiteMap
must uniquely return aHstSiteMap.getSiteMapItemByRefId(String)
HstSiteMapItem
. The difference withgetId()
is that thatid
is in general an auto-generated id, where thisgetRefId()
is an optional id to get hold of thisHstSiteMapItem
.- Returns:
- the refId of this HstSiteMapItem or
null
when no refId is defined on theHstSiteMapItem
-
getApplicationId
String getApplicationId()Expert: The
getApplicationId()
is useful in case multiple application types are being served by a singleMount
. This can for example be the case of part of the requests for theMount
of thisHstSiteMapItem
are served as document requests (normal web pages), but for example another part of the requests are served by a single web application: A single web application might choose to serve a new page via an XHR request instead of a document request. In order for an SPA to 'know' whether it can serve a link as part of the SPA via an XHR request or via a full document request, it should know whether the sitemap item for the targeted link is part of the same 'application'. This can be configured on site map item level by specifying an application id. The application id is inherited by childHstSiteMapItem
s from its parent- Returns:
- the application id of this
HstSiteMapItem
ornull
in case no applicationId is defined
-
getQualifiedId
String getQualifiedId()The qualified id, which might contain more info then justgetId()
as the getId might return an id which is meaningfull only within it's currentHstSiteMap
- Returns:
- the qualified id of this HstSiteMapItem
-
getValue
String getValue()Returns the logical path element of thisSiteMapItem
. The constraint to the return value is, that it needs to be unique within the sibblingHstSiteMapItem
's because it is used as a key for
andgetChild(String)
HstSiteMap.getSiteMapItem(String)
- Returns:
- the value of this
SiteMapItem
which represents the logical path element for thisSiteMapItem
-
getPageTitle
String getPageTitle()- Returns:
- the page title for this
HstSiteMapItem
ornull
if not configured
-
isWildCard
boolean isWildCard()Returns a boolean indicating whether thisHstSiteMapItem
represents a path with awildcard
value*
- Returns:
true
if thisHstSiteMapItem
represents*
-
containsWildCard
boolean containsWildCard()- Returns:
true
when thisHstSiteMapItem
represents a path that contains a*
but is not equals to a*
(for example *.html)
-
isAny
boolean isAny()Returns a boolean indicating whether thisHstSiteMapItem
represents a path with aany
value**
- Returns:
true
if thisHstSiteMapItem
represents**
-
containsAny
boolean containsAny()- Returns:
true
when thisHstSiteMapItem
represents a path that contains**
but is not equals to**
(for example **.html)
-
isExplicitElement
boolean isExplicitElement()- Returns:
true
whenisWildCard()
,isAny()
,containsWildCard()
andcontainsAny()
all return false
-
isExplicitPath
boolean isExplicitPath()- Returns:
true
when this item plus all its ancestorHstSiteMapItem
s returntrue
forisExplicitElement()
-
getRelativeContentPath
String getRelativeContentPath()This method returns a content path, relative to theMount.getContentPath()
. This value can contain property placeholders, like ${1}/${2}, which should be resolved in theResolvedSiteMapItem.getRelativeContentPath()
- Returns:
- the content path relative to the
Mount.getContentPath()
-
getComponentConfigurationId
String getComponentConfigurationId()If a HstSiteMapItem can be used to resolve a url, it must have a componentConfigurationId referencing the component configuration the will handle the request processing. This component configuration can be the root of a component configuration tree, seeHstComponentConfiguration
.- Returns:
- the componentConfigurationId for this
SiteMapItem
ornull
-
getComponentConfigurationIdMappings
- Returns:
- the
Map
of keys to more specific configurationId's andnull
if there are no mappings defined - See Also:
-
isAuthenticated
boolean isAuthenticated()If this method returns true, then only if the user is explicitly allowed orservletRequest.isUserInRole(role)
returnstrue
this sitemap item is accessible for the request.If a sitemap item does not have a configuration for authenticated, the value from the parent item is taken. The root sitemap items return by default
false
forisAuthenticated()
when no configuration is set for authenticated.- Returns:
true
if the sitemap item is authenticated.
-
getRoles
Returns the roles that are allowed to access this sitemap item whenisAuthenticated()
is true. If the sitemap items 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 itemHstComponent
instances can accessHstSiteMapItem
but should not be able to modify them, implementations should return an unmodifiable set.- Returns:
- The set of roles that are allowed to access this sitemap item. 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
Returns the users that are allowed to access this sitemap item whenisAuthenticated()
is true. If the sitemap items 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 itemHstComponent
instances can accessHstSiteMapItem
but should not be able to modify them, implementations should return an unmodifiable set.- Returns:
- The set of users that are allowed to access this sitemap item. 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
-
isExcludedForLinkRewriting
boolean isExcludedForLinkRewriting()When having more sitemapitem as siblings, for example foo.xml, foo.html and foo.rss, you might not want all three being used for linkrewriting: Even worse, if they all three have the same
getRelativeContentPath()
, we cannot choose which one is the one you want, so, one of the items is used. When configuring a SiteMapItem to returntrue
for isExcludedForLinkRewriting(), you can exclude the item to be used for linkrewriting. Thus, setting the .rss and .xml version totrue
will make sure that linkrewriting returns you the .html links.Note that this value is not inherited from ancestor HstSiteMapItem's
- Returns:
true
when this sitemap item should be ignored for linkrewriting
-
getChildren
List<HstSiteMapItem> getChildren()Returns aList
of all childHstSiteMapItem
's of thisHstSiteMapItem
. Implementations should return an unmodifiable list, for exampleCollections.unmodifiableList(java.util.List<? extends T>)
to avoid client code changing configuration- Returns:
- the List of HstSiteMapItem children. If there are no children, an empty list is returned
-
getChild
- Parameters:
value
- the value of the childHstSiteMapItem
as it would be return bygetValue()
- Returns:
- Returns the HstSiteMapItem object corresponding to the unique
value
andnull
if noHstSiteMapItem
exists with thisvalue
in thisHstSiteMapItem
object.
-
getParameter
A HstSiteMapItem can contain a Map of parameters. These parameters can be accessed fromHstComponent
's instances through a parameter in theHstComponentConfiguration
. For example, if thisSiteMapItem
would have a parameter namedfoo
and valuebar
, theHstComponentConfiguration
linked through thegetComponentConfigurationId()
can access this parameters by having an own parameter, for example namedlux
and the value${foo}
. If theHstSiteMapItem
is a WILDCARD or any of its ancestors, you can also set the parameter values to${1}
,${2}
etc where${1}
refers to the first matched wildcard,${2}
to the second, etc.Parameters are inherited from ancestor sitemap items. When this sitemap item configures the same parameter as an ancestor, the value from the ancestor is overwritten. Thus, child items have precedence. Note that this is opposite to
HstComponentConfiguration.getParameter(String)
- Parameters:
name
- the name of the parameter- Returns:
- the value of the parameter or
null
when not present
-
getLocalParameter
seegetParameter(String)
, only this method returns parameters without inheritance- Parameters:
name
- the name of the parameter- Returns:
- the value of the parameter or
null
when not present
-
getParameters
SeegetParameter(String)
, only now entire the parameters map is returned. Implementations should return an unmodifiable map, for exampleCollections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
to avoid client code changing configurationParameters are inherited from ancestor sitemap items. When this sitemap item configures the same parameter as an ancestor, the value from the ancestor is overwritten. Thus, child items have precedence. Note that this is opposite to
HstComponentConfiguration.getParameters()
- Returns:
- the Map of parameters contained in this
HstSiteMapItem
. If no parameters present, and empty map is returned
-
getLocalParameters
seegetParameters()
, only this method returns parameters (unmodifiable map) without inheritance- Returns:
- the Map of parameters contained in this
HstSiteMapItem
. If no parameters present, and empty map is returned
-
getParentItem
HstSiteMapItem getParentItem()Returns parentHstSiteMapItem
andnull
when the item does not have a parent (in other words, it is a rootHstSiteMapItem
)- Returns:
- the parent
HstSiteMapItem
andnull
when the item does not have a parent
-
getHstSiteMap
HstSiteMap getHstSiteMap()Return theHstSiteMap
that is the container of thisHstSiteMapItem
- Returns:
- the
HstSiteMap
that is the container of thisHstSiteMapItem
-
getStatusCode
int getStatusCode()AHstSiteMapItem
can specify the status-code that needs to be set on the webpage header. If a status-code is specified, it can be retrieved through this method.0
is return is non is specified.- Returns:
- if a status code is set, return this, otherwise
0
-
getErrorCode
int getErrorCode()AHstSiteMapItem
can specify an error-code. If an error-code is specified, the framework will invoke a sendError(int code) where the code is the value returned by this method .0
is return is non is specified.- Returns:
- if an error code is set, return this, otherwise
0
-
getNamedPipeline
String getNamedPipeline()the namedPipeline for this sitemapItem ornull
when it does not contain one. Note that if an ancestor sitemapItem contains a namedPipeline, this value is inherited unless this sitemapItem explicitly defines its own- Returns:
- the namedPipeline for this sitemapItem or
null
when it does not contain one.
-
getLocale
String getLocale()the locale for this sitemapItem ornull
when it does not contain one. Note that if an ancestor sitemapItem contains a locale, this value is inherited unless this sitemapItem explicitly defines its own.- Returns:
- the locale for this sitemapItem or
null
when it does not contain one.
-
getSiteMapItemHandlerConfiguration
Deprecated.since 13.0.0. OnlygetHstSiteMapItemHandlers()
will possibly be supported in future via api but even that method might disappear in the future- Parameters:
handlerId
-- Returns:
- the
HstSiteMapItemHandlerConfiguration
forhandlerId
ornull
if no handler present forhandlerId
-
getSiteMapItemHandlerConfigurations
Deprecated.since 13.0.0. OnlygetHstSiteMapItemHandlers()
will possibly be supported in future via api but even that method might disappear in the futureThe List of
HstSiteMapItemHandlerConfiguration
s and an empty list if this SiteMapItem does not containHstSiteMapItemHandlerConfiguration
s.
Note thatHstSiteMapItemHandlerConfiguration
s are NOT inherited from parent/ancestor HstSiteMapItem's.Implementations should return an unmodifiable list, for example
Collections.unmodifiableList(java.util.List<? extends T>)
to avoid client code changing configuration- Returns:
- The List of
HstSiteMapItemHandlerConfiguration
s and an empty list if this SiteMapItem does not containHstSiteMapItemHandlerConfiguration
s
-
isCacheable
boolean isCacheable()- Returns:
true
if rendering / resource requests can have their entire page http responses cached.
-
getScheme
String getScheme()The scheme of a site map item specifies which scheme is to be used for serving this site map item. The value of this property is derived in the following order:- If the hst:scheme property is set for this site map item, then that is used
- If this site map item has a parent, it will use the parent's scheme
- If the mount that this site map item belongs to has a scheme set, then that is used
If a site map item has an hst:scheme property, but it is left blank then the scheme defaults to
VirtualHosts.DEFAULT_SCHEME
- Returns:
- the scheme of this site map item
-
isSchemeAgnostic
boolean isSchemeAgnostic()If aHstSiteMapItem
is scheme agnostic, the request gets served regardless whether it ishttp
orhttps
- Returns:
true
when thisHstSiteMapItem
is scheme agnostic
-
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
HstSiteMapItem
orMount
-
getResourceBundleIds
String[] getResourceBundleIds()- Returns:
- resource bundle IDs for this sitemapitem and descendants to use, for example {
"org.example.resources.MyResources" }, or an empty array when not configured on this
HstSiteMapItem
and empty from ancestorHstSiteMapItem
or when root sitemapitem fromMount.getDefaultResourceBundleIds()
-
isContainerResource
boolean isContainerResource()A sitemap item that should serve (a) container resource(s) can be marked to do so by returningtrue
fromisContainerResource()
. When anHstLink
for such aHstSiteMapItem
is created, the resulting URL will be webapp relative and not relative toMount.getMountPath()
for thisHstSiteMapItem
.- Returns:
true
when the this sitemap item should serve(a) container resource(s).
-
isHiddenInChannelManager
boolean isHiddenInChannelManager()- Returns:
true
when thisHstSiteMapItem
is explicitly marked to be hidden in the channel mngr pages overview. When not explicitly configured,false
is returned. This does not imply per se the sitemap item is shown as page in the channel mngr overview page. For example a sitemap item that contains wildcars or is a container resource, seeisContainerResource()
, is not shown either
-
isMarkedDeleted
boolean isMarkedDeleted()Returnstrue
when thisHstSiteMapItem
is marked as deleted. AHstSiteMapItem
that is marked to be deleted won't take part in matching or linkrewriting. A childHstSiteMapItem
will also be marked as deleted if its parent is marked deleted.- Returns:
true
when thisHstSiteMapItem
is marked as deleted.
-
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.
-
getHstSiteMapItemHandlers
List<HstSiteMapItemHandler> getHstSiteMapItemHandlers()- Returns:
- the list of
HstSiteMapItemHandler
s for thisHstSiteMapItem
and an empty list if none present
-