public interface HstSiteMapItem
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.
Modifier and Type | Method and Description |
---|---|
boolean |
containsAny() |
boolean |
containsWildCard() |
String |
getApplicationId()
Expert: The
getApplicationId() is useful in case multiple application types are being served by a
single Mount . |
HstSiteMapItem |
getChild(String value)
|
List<HstSiteMapItem> |
getChildren()
Returns a
List of all child HstSiteMapItem 's of this HstSiteMapItem . |
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.
|
Map<String,String> |
getComponentConfigurationIdMappings() |
int |
getErrorCode()
A
HstSiteMapItem can specify an error-code. |
HstSiteMap |
getHstSiteMap()
Return the
HstSiteMap that is the container of this HstSiteMapItem |
List<HstSiteMapItemHandler> |
getHstSiteMapItemHandlers() |
String |
getId()
The id of a
HstSiteMapItem is mandatory and must be unique within its containing because must uniquely return a
HstSiteMapItem . |
String |
getLocale()
the locale for this sitemapItem or
null when it does not contain one. |
String |
getLocalParameter(String name)
see
getParameter(String) , only this method returns parameters without inheritance |
Map<String,String> |
getLocalParameters()
see
getParameters() , only this method returns parameters (unmodifiable map) without inheritance |
String |
getNamedPipeline()
the namedPipeline for this sitemapItem or
null when it does not contain one. |
String |
getPageTitle() |
String |
getParameter(String name)
A HstSiteMapItem can contain a Map of parameters.
|
Map<String,String> |
getParameters()
See
getParameter(String) , only now entire the parameters map is returned. |
HstSiteMapItem |
getParentItem()
Returns parent
HstSiteMapItem and null when the item does not have a parent (in other
words, it is a root HstSiteMapItem ) |
String |
getQualifiedId()
The qualified id, which might contain more info then just
getId() as the getId might return an id which
is meaningfull only within it's current HstSiteMap |
String |
getRefId()
The refId of a
HstSiteMapItem is non-mandatory and must be unique within its containing
because must
uniquely return a HstSiteMapItem . |
String |
getRelativeContentPath()
This method returns a content path, relative to the
Mount.getContentPath() . |
String[] |
getResourceBundleIds() |
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 sitemap item when
isAuthenticated() is true. |
String |
getScheme()
The scheme of a site map item specifies which scheme is to be used for serving this site map item.
|
int |
getSchemeNotMatchingResponseCode()
|
HstSiteMapItemHandlerConfiguration |
getSiteMapItemHandlerConfiguration(String handlerId)
Deprecated.
since 13.0.0. Only
getHstSiteMapItemHandlers() will possibly be supported in future via api
but even that method might disappear in the future |
List<HstSiteMapItemHandlerConfiguration> |
getSiteMapItemHandlerConfigurations()
Deprecated.
since 13.0.0. Only
getHstSiteMapItemHandlers() will possibly be supported in future via api
but even that method might disappear in the future |
int |
getStatusCode()
A
HstSiteMapItem can specify the status-code that needs to be set on the webpage header. |
Set<String> |
getUsers()
Returns the users that are allowed to access this sitemap item when
isAuthenticated() is true. |
String |
getValue()
Returns the logical path element of this
SiteMapItem . |
boolean |
isAny()
Returns a boolean indicating whether this
HstSiteMapItem represents a path with a any
value ** |
boolean |
isAuthenticated()
If this method returns true, then only if the user is explicitly allowed or
servletRequest.isUserInRole(role)
returns true this sitemap item is accessible for the request. |
boolean |
isCacheable() |
boolean |
isContainerResource()
A sitemap item that should serve (a) container resource(s) can be marked to do so by returning
true
from isContainerResource() . |
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. |
boolean |
isExplicitElement() |
boolean |
isExplicitPath() |
boolean |
isHiddenInChannelManager() |
boolean |
isMarkedDeleted()
Returns
true when this HstSiteMapItem is marked as deleted. |
boolean |
isSchemeAgnostic()
If a
HstSiteMapItem is scheme agnostic, the request gets served regardless whether it is
http or https |
boolean |
isWildCard()
Returns a boolean indicating whether this
HstSiteMapItem represents a path with a
wildcard value * |
String getId()
HstSiteMapItem
is mandatory and must be unique within its containing HstSiteMap
because HstSiteMap.getSiteMapItemById(String)
must uniquely return a
HstSiteMapItem
.String getRefId()
HstSiteMapItem
is non-mandatory and must be unique within its containing
HstSiteMap
because HstSiteMap.getSiteMapItemByRefId(String)
must
uniquely return a HstSiteMapItem
. The difference with getId()
is that that id
is in general an auto-generated id, where this getRefId()
is an optional id to get hold of this HstSiteMapItem
.null
when no refId is defined on the HstSiteMapItem
String getApplicationId()
Expert: The getApplicationId()
is useful in case multiple application types are being served by a
single Mount
. This can for example be the case of part of the requests for the Mount
of this
HstSiteMapItem
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 child HstSiteMapItem
s from its parent
HstSiteMapItem
or null
in case no applicationId is definedString getQualifiedId()
getId()
as the getId might return an id which
is meaningfull only within it's current HstSiteMap
String getValue()
SiteMapItem
. The constraint to the return value is, that it
needs to be unique within the sibbling HstSiteMapItem
's because it is used as a key for getChild(String)
and HstSiteMap.getSiteMapItem(String)
SiteMapItem
which represents the logical path element for this
SiteMapItem
String getPageTitle()
HstSiteMapItem
or null
if not configuredboolean isWildCard()
HstSiteMapItem
represents a path with a
wildcard
value *
true
if this HstSiteMapItem
represents *
boolean containsWildCard()
true
when this HstSiteMapItem
represents a path that contains a *
but is not equals to a *
(for example *.html)boolean isAny()
HstSiteMapItem
represents a path with a any
value **
true
if this HstSiteMapItem
represents **
boolean containsAny()
true
when this HstSiteMapItem
represents a path that contains **
but is not equals to **
(for example **.html)boolean isExplicitElement()
true
when isWildCard()
, isAny()
, containsWildCard()
and containsAny()
all return falseboolean isExplicitPath()
true
when this item plus all its ancestor HstSiteMapItem
s return true
for isExplicitElement()
String getRelativeContentPath()
Mount.getContentPath()
. This value can contain
property placeholders, like ${1}/${2}, which should be resolved in the ResolvedSiteMapItem.getRelativeContentPath()
Mount.getContentPath()
String getComponentConfigurationId()
HstComponentConfiguration
.SiteMapItem
or null
Map<String,String> getComponentConfigurationIdMappings()
Map
of keys to more specific configurationId's and null
if there are no mappings
definedgetComponentConfigurationId()
boolean isAuthenticated()
servletRequest.isUserInRole(role)
returns true
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
for isAuthenticated()
when no configuration is
set for authenticated.
true
if the sitemap item is authenticated.Set<String> getRoles()
isAuthenticated()
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 with isAuthenticated()
return true
means nobody has access to the item
HstComponent
instances can access HstSiteMapItem
but should not be able to modify them,
implementations should return an unmodifiable set.
Set<String> getUsers()
isAuthenticated()
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 with isAuthenticated()
return true
means nobody has access to the item
HstComponent
instances can access HstSiteMapItem
but should not be able to modify them,
implementations should return an unmodifiable set.
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 return true
for isExcludedForLinkRewriting(), you can exclude the item
to be used for linkrewriting. Thus, setting the .rss and .xml version to true
will make sure that
linkrewriting returns you the .html links.
Note that this value is not inherited from ancestor HstSiteMapItem's
true
when this sitemap item should be ignored for linkrewritingList<HstSiteMapItem> getChildren()
List
of all child HstSiteMapItem
's of this HstSiteMapItem
.
Implementations should return an unmodifiable list, for example Collections.unmodifiableList(java.util.List<? extends T>)
to
avoid client code changing configurationHstSiteMapItem getChild(String value)
value
- the value of the child HstSiteMapItem
as it would be return by getValue()
value
and null
if
no HstSiteMapItem
exists with this value
in this HstSiteMapItem
object.String getParameter(String name)
HstComponent
's
instances through a parameter in the HstComponentConfiguration
. For example, if this
SiteMapItem
would have a parameter named foo
and value bar
, the HstComponentConfiguration
linked through the getComponentConfigurationId()
can access this parameters
by having an own parameter, for example named lux
and the value ${foo}
. If the
HstSiteMapItem
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)
name
- the name of the parameternull
when not presentString getLocalParameter(String name)
getParameter(String)
, only this method returns parameters without inheritancename
- the name of the parameternull
when not presentMap<String,String> getParameters()
getParameter(String)
, only now entire the parameters map is returned. Implementations should return
an unmodifiable map, for example Collections.unmodifiableMap(java.util.Map<? extends K, ? extends V>)
to avoid client code changing
configuration
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.getParameters()
HstSiteMapItem
. If no parameters present, and empty
map is returnedMap<String,String> getLocalParameters()
getParameters()
, only this method returns parameters (unmodifiable map) without inheritanceHstSiteMapItem
. If no parameters present, and empty
map is returnedHstSiteMapItem getParentItem()
HstSiteMapItem
and null
when the item does not have a parent (in other
words, it is a root HstSiteMapItem
)HstSiteMapItem
and null
when the item does not have a parentHstSiteMap getHstSiteMap()
HstSiteMap
that is the container of this HstSiteMapItem
HstSiteMap
that is the container of this HstSiteMapItem
int getStatusCode()
HstSiteMapItem
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.0
int getErrorCode()
HstSiteMapItem
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.0
String getNamedPipeline()
null
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 ownnull
when it does not contain one.String getLocale()
null
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.null
when it does not contain one.@Deprecated HstSiteMapItemHandlerConfiguration getSiteMapItemHandlerConfiguration(String handlerId)
getHstSiteMapItemHandlers()
will possibly be supported in future via api
but even that method might disappear in the futurehandlerId
- HstSiteMapItemHandlerConfiguration
for handlerId
or null
if no
handler present for handlerId
@Deprecated List<HstSiteMapItemHandlerConfiguration> getSiteMapItemHandlerConfigurations()
getHstSiteMapItemHandlers()
will possibly be supported in future via api
but even that method might disappear in the future The List of HstSiteMapItemHandlerConfiguration
s and an empty list if this SiteMapItem does not
contain HstSiteMapItemHandlerConfiguration
s.
Note that HstSiteMapItemHandlerConfiguration
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
HstSiteMapItemHandlerConfiguration
s and an empty list if this SiteMapItem does not
contain HstSiteMapItemHandlerConfiguration
sboolean isCacheable()
true
if rendering / resource requests can have their entire page http responses cached.String getScheme()
If a site map item has an hst:scheme property, but it is left blank then the scheme defaults to VirtualHosts.DEFAULT_SCHEME
boolean isSchemeAgnostic()
HstSiteMapItem
is scheme agnostic, the request gets served regardless whether it is
http
or https
true
when this HstSiteMapItem
is scheme agnosticint 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 HstSiteMapItem
or Mount
String[] getResourceBundleIds()
HstSiteMapItem
and
empty from ancestor HstSiteMapItem
or when root sitemapitem from Mount.getDefaultResourceBundleIds()
boolean isContainerResource()
true
from isContainerResource()
. When an HstLink
for such a HstSiteMapItem
is created, the resulting URL will be webapp relative and not relative to Mount.getMountPath()
for this HstSiteMapItem
.true
when the this sitemap item should serve(a) container resource(s).boolean isHiddenInChannelManager()
true
when this HstSiteMapItem
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, see isContainerResource()
, is not shown eitherboolean isMarkedDeleted()
true
when this HstSiteMapItem
is marked as deleted. A HstSiteMapItem
that is
marked to be deleted won't take part in matching or linkrewriting. A child HstSiteMapItem
will also be
marked as deleted if its parent is marked deleted.true
when this HstSiteMapItem
is marked as deleted.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
List<HstSiteMapItemHandler> getHstSiteMapItemHandlers()
HstSiteMapItemHandler
s for this HstSiteMapItem
and an empty list if none presentCopyright © 2008–2020 Hippo B.V. (http://www.onehippo.com). All rights reserved.