Interface HstRequestContext
- All Superinterfaces:
ModelContributable
- All Known Subinterfaces:
HstMutableRequestContext
- Version:
- $Id$
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) Retrieve the attribute value by the attribute name.Enumerates the attribute namesReturns attribute map which is unmodifiable.Returns the base container URL (HstContainerURL
) of the current request lifecycle.Expert: The tags that will be used to render container items.Expert: Option to add filters to theHstRequestContext
.Returns theHstContainerURLProvider
to create HstContainerURLsReturns the contentHippoBean
for this request.<T extends HippoBean>
TgetContentBean
(Class<T> beanMappingClass) Returns same asgetContentBean()
but if the foundHippoBean
is not of typebeanMappingClass
, thennull
is returned.Returns the context credentials providergetHeadContributable
(String name) ReturnHeadContributable
object by thename
if found.Return a non-null unmodifiable map ofHeadContributable
objects keyed by their contributor names.Returns theHstLinkCreator
to create navigational linksReturns aHstQueryManagerFactory
instance responsible for creating a query managerReturns the type of this request.Returns an Enumeration of Locale objectsa mount withMount.getAlias()
equal toalias
and at least one common type with the mount from the current request.getObjectBeanManager
(Session session) Returns theObjectConverter
for the currentHstRequestContext
.Expert: ReturnsHstParameterInfoProxyFactory
to create a proxy for an interface that is referred to by aParametersInfo
annotation on aHstComponent
annotated interface gettersReturns the path suffix from the resolved site map item.Gets the preferred locale associated with this request.getQueryManager
(Session session) Returns theResolvedMount
for this requestReturns theResolvedSiteMapItem
for this requestjakarta.servlet.ServletContext
Returns the ServletContext for this requestjakarta.servlet.http.HttpServletRequest
Returns the current HttpServletRequestjakarta.servlet.http.HttpServletResponse
Returns the current HttpServletResponseReturns a session which is normally retrieved from a session pooling repository.getSession
(boolean create) Returns a session which can be retrieved from a session pooling repository.Returns the siteContentBaseBeanHippoBean
for this request.Returns theHstSiteMapMatcher
to be able to match a path to a sitemap itemGets the subject associated with the authorized entity.Returns theHstURLFactory
to create HstURLsReturns the matched virtual host objectboolean
boolean
boolean
boolean
boolean
boolean
when the current request is rendering a history version, this boolean is true (note a node from version history does not per se mean that the request is rendering history since it might be the most recent version of a branch still.boolean
Return true if it was determined that the request comes from a search engine.void
removeAttribute
(String name) Removes the attribute by the attribute name.void
setAttribute
(String name, Object object) Set an attribute to be shared among each HstComponent windows.void
setHeadContributable
(String name, HeadContributable headContributable) Set aHeadContributable
object by thename
.Methods inherited from interface org.hippoecm.hst.core.ModelContributable
getModel, getModelNames, getModelsMap, removeModel, setModel
-
Method Details
-
getServletContext
jakarta.servlet.ServletContext getServletContext()Returns the ServletContext for this request- Returns:
- the ServletContext for this request
-
getServletRequest
jakarta.servlet.http.HttpServletRequest getServletRequest()Returns the current HttpServletRequest- Returns:
- the current HttpServletRequest
-
getServletResponse
jakarta.servlet.http.HttpServletResponse getServletResponse()Returns the current HttpServletResponse- Returns:
- the current HttpServletResponse
-
getSession
Returns a session which is normally retrieved from a session pooling repository.Returns the current
javax.jcr.Session
associated with this requestContext or, if if there is no current JCR session, creates and returns a new JCR session.- Returns:
- a session, which is normally retrieved from a session pooling repository
- Throws:
LoginException
RepositoryException
-
getSession
Returns a session which can be retrieved from a session pooling repository.Returns the current
javax.jcr.Session
associated with this requestContext or, if if there is no current JCR session andcreate
is true, returns a new JCR session.If
create
isfalse
and the requestContext has nojavax.jcr.Session
, this method returnsnull
.- Returns:
- a session, which is normally retrieved from a session pooling repository
- Throws:
LoginException
RepositoryException
-
getResolvedMount
ResolvedMount getResolvedMount()Returns theResolvedMount
for this request- Returns:
- the
ResolvedMount
for this request
-
getResolvedSiteMapItem
ResolvedSiteMapItem getResolvedSiteMapItem()Returns theResolvedSiteMapItem
for this request- Returns:
- the resolvedSiteMapItem for this request
-
isPreview
boolean isPreview()- Returns:
true
when this request is matched to a preview site- See Also:
-
getBaseURL
HstContainerURL getBaseURL()Returns the base container URL (HstContainerURL
) of the current request lifecycle.- Returns:
- HstContainerURL
-
getURLFactory
HstURLFactory getURLFactory()Returns theHstURLFactory
to create HstURLs- Returns:
- HstURLFactory
-
getContainerURLProvider
HstContainerURLProvider getContainerURLProvider()Returns theHstContainerURLProvider
to create HstContainerURLs- Returns:
- HstContainerURLProvider
-
getSiteMapMatcher
HstSiteMapMatcher getSiteMapMatcher()Returns theHstSiteMapMatcher
to be able to match a path to a sitemap item- Returns:
- HstSiteMapMatcher
-
getHstLinkCreator
HstLinkCreator getHstLinkCreator()Returns theHstLinkCreator
to create navigational links- Returns:
- HstLinkCreator
-
getHstSiteMenus
HstSiteMenus getHstSiteMenus()- Returns:
- the HstSiteMenus
- Throws:
IllegalStateException
- when this method is invoked while there is noResolvedSiteMapItem
available on thisHstRequestContext
viagetResolvedSiteMapItem()
-
getHstQueryManagerFactory
HstQueryManagerFactory getHstQueryManagerFactory()Returns aHstQueryManagerFactory
instance responsible for creating a query manager- Returns:
- HstQueryManagerFactory
-
getParameterInfoProxyFactory
HstParameterInfoProxyFactory getParameterInfoProxyFactory()Expert: ReturnsHstParameterInfoProxyFactory
to create a proxy for an interface that is referred to by aParametersInfo
annotation on aHstComponent
annotated interface getters- Returns:
- the
HstParameterInfoProxyFactory
-
setAttribute
Set an attribute to be shared among each HstComponent windows. Because this attribute is not prefixed by the reference namespace of the HstComponent window, this method can be used if the attribute is to be shared among HstComponent windows.- Parameters:
name
- attribute nameobject
- attribute value
-
getAttribute
Retrieve the attribute value by the attribute name. Because this attribute is not prefixed by the reference namespace of the HstComponent window, this method can be used if the attribute is to be shared among HstComponent windows. -
removeAttribute
Removes the attribute by the attribute name. -
getAttributeNames
Enumeration<String> getAttributeNames()Enumerates the attribute names -
getAttributes
Returns attribute map which is unmodifiable. So, do not try to put or remove items directly from the returned map.- Returns:
- attribute map which is unmodifiable. So, do not try to put or remove items directly from the returned map.
-
getVirtualHost
VirtualHost getVirtualHost()Returns the matched virtual host object- Returns:
- the matched virtual host object
-
getContainerConfiguration
ContainerConfiguration getContainerConfiguration()- Returns:
- Returns the
ContainerConfiguration
-
isChannelManagerPreviewRequest
boolean isChannelManagerPreviewRequest()- Returns:
true
when the request is for the preview of the site in the Channel Manager
-
isChannelManagerRestRequest
boolean isChannelManagerRestRequest()- Returns:
true
when the request is for a REST invocation in the Channel Manager
-
getHstRequestType
HstRequestContext.HstRequestType getHstRequestType()Returns the type of this request. In case the returned type is
HstRequestContext.HstRequestType.CHANNEL_MGR_PREVIEW
thenisChannelManagerPreviewRequest()
is always true as well. Likewise ifHstRequestContext.HstRequestType.CHANNEL_MGR_REST
is returned, thenisChannelManagerRestRequest()
will also returntrue
- Returns:
- the
HstRequestType
of this request, ornull
in case it has not been set
-
isPageModelApiRequest
boolean isPageModelApiRequest()- Returns:
true
in case the current request is a Page Model API request
-
isRenderingHistory
boolean isRenderingHistory()when the current request is rendering a history version, this boolean is true (note a node from version history does not per se mean that the request is rendering history since it might be the most recent version of a branch still. This is true only when really a specific older historic version is being rendered.
Only when
isChannelManagerPreviewRequest()
istrue
, this methodisRenderingHistory()
can be true- Returns:
true
in case the current request is rendering a history version
-
getContextCredentialsProvider
ContextCredentialsProvider getContextCredentialsProvider()Returns the context credentials provider- Returns:
- the context credentials provider
-
getSubject
Subject getSubject()Gets the subject associated with the authorized entity.- Returns:
- The JAAS subject on this request.
-
getPreferredLocale
Locale getPreferredLocale()Gets the preferred locale associated with this request.- Returns:
- The preferred locale associated with this request.
-
getLocales
Enumeration<Locale> getLocales()Returns an Enumeration of Locale objects- Returns:
- The locale associated with this request.
-
getPathSuffix
String getPathSuffix()Returns the path suffix from the resolved site map item. If it is null, then returns the path suffix from the resolved Mount.- Returns:
- the matched path suffix and
null
if there is no path suffix
-
getMount
a mount with
Mount.getAlias()
equal toalias
and at least one common type with the mount from the current request. Thus, at least one of the types of the foundMount.getTypes()
must be equal to one of the types of the mount of the current request.If there can be found a
Mount
with the same primary type (Mount.getType()
) as the one for the mount of the current request, thisMount
has precedence. If there is no primary type match, we'll return the mount that has most types in commonThere will be looked if the
Mount
of the currentHstRequestContext
has a property that is calledhst:mountXXX
whereXXX
is equal toalias
. If so, there will be tried to return aMount
that has an alias equal to the value of this mappedAlias propertyhst:mountXXX
. If there cannot be found aMount
for via a mappedhst:mountXXX
property, there will be looked for aMount
with which hasMount.getAlias()
equal toalias
. Thus a mapped alias has precedence!- Parameters:
alias
- the alias the foundMount
or XXX in hst:mountXXX property- Returns:
- a mount with
Mount.getAlias()
equal toalias
or mappedAlias and at least one common type with the mount from the current request.null
if there is no suitable mount. - Throws:
IllegalArgumentException
- whenalias
isnull
-
getMount
a mount with
Mount.getAlias()
equal toalias
and one of itsMount.getTypes()
equal totype
.There will be looked if the
Mount
of the currentHstRequestContext
has a property that is calledhst:mountXXX
whereXXX
is equal toalias
. If so, there will be tried to return aMount
that has an alias equal to the value of this mappedAlias propertyhst:mountXXX
. If there cannot be found aMount
for via a mappedhst:mountXXX
property, there will be looked for aMount
with which hasMount.getAlias()
equal toalias
.- Parameters:
alias
- the alias the foundMount
or or XXX in hst:mountXXX propertytype
- the type the foundMount
should have- Returns:
- a mount with
Mount.getAlias()
equal toalias
or mappedAlias and one of itsMount.getTypes()
equal totype
.null
if there is no suitable mount. - Throws:
IllegalArgumentException
- whenalias
ortype
isnull
-
getComponentFilterTags
Expert: The tags that will be used to render container items. These tags can be used by a
HstComponentFactory
implementation to decide to load some specificHstComponentWindow
s only.This method is in general not useful for frontend developers and is more targetted for the HST Core
HST Core
HstComponentFactory
implementations behave as follows: When tags are available, and there is a container item in a container that matches the tag, those container items will be rendered at the exclusion of the other items. If no tags are provided, or none matches any of the tags on the container items, only those container items that do not have a tag will be rendered.- Returns:
- The (immutable) active set of filter tags, empty when conditional rendering is not used.
-
getComponentWindowFilters
List<HstComponentWindowFilter> getComponentWindowFilters()Expert: Option to add filters to the
HstRequestContext
. Note that this only affects outcome if it is done before the actual doBeforeRender / doAction etc or rendering is invoked by the HST- Returns:
- the (immutable)
List
ofHstComponentWindowFilter
s and if none present, return a empty List
-
isFullyQualifiedURLs
boolean isFullyQualifiedURLs()- Returns:
true
when all URLs must be fully qualified, ie, including scheme, domain and portnumber (if present)
-
getRenderHost
String getRenderHost()- Returns:
- the render host to use for rendering the request or
null
when no specific render host is defined. Typically, there is only a render host when the request originated from the CMS
-
getContentBeansTool
ContentBeansTool getContentBeansTool()- Returns:
- A
ContentBeansTool
instance. Note that theContentBeansTool
instance is an object shared by multiple threads. Invoking this method before theContentBeansTool
is set on theHstRequestContext
results innull
being returned. As of 2.26.xx, this is for example the case when invokinggetContentBeansTool()
during execution of aHstSiteMapItemHandler
-
getObjectConverter
ObjectConverter getObjectConverter()Returns theObjectConverter
for the currentHstRequestContext
. Note the returnedObjectConverter
is likely to be a different one than returned vuagetContentBeansTool().getObjectConverter()
because the latter is a non-caching object converter while thisgetObjectConverter()
returns possibly a caching object converter- Returns:
- the
ObjectConverter
for the currentHstRequestContext
-
getSiteContentBasePath
String getSiteContentBasePath()- Returns:
- the root content path relative to the root node for the
ResolvedMount
belonging to the currentHttpServletRequest
. The path never starts with a "/" as it is relative to the root node.
-
getSiteContentBaseBean
HippoBean getSiteContentBaseBean()Returns the siteContentBaseBeanHippoBean
for this request. After first retrieval, the bean is cached and the same instance will be returned when callinggetSiteContentBaseBean()
multiple times. The backing jcrNode
is fetched through jcr SessiongetSession()
- Returns:
- the
HippoBean
belonging to forgetSiteContentBasePath()
-
getContentBean
HippoBean getContentBean()Returns the contentHippoBean
for this request. After first retrieval, the content bean is cached and the same instance will be returned when callinggetContentBean()
multiple times. The backing jcrNode
is fetched through jcr SessiongetSession()
- Returns:
HippoBean
belonging to theResolvedSiteMapItem
ornull
HstSiteMapItem.getRelativeContentPath()
isnull
or when there is no content (jcr node) to be found atHstSiteMapItem.getRelativeContentPath()
.
-
getContentBean
Returns same asgetContentBean()
but if the foundHippoBean
is not of typebeanMappingClass
, thennull
is returned.- Returns:
HippoBean
of typebeanMappingClass
ornull
- See Also:
-
getObjectBeanManager
- Returns:
- a
ObjectBeanManager
instance for the currentHstRequestContext
backed by thegetSession()
- Throws:
IllegalStateException
- if the application is unable to provide a ObjectBeanManager
-
getObjectBeanManager
- Parameters:
session
- theSession
to create thisObjectBeanManager
with- Returns:
- a
ObjectBeanManager
instance for the currentHstRequestContext
backed by thesession
- Throws:
IllegalStateException
- if the application is unable to provide a ObjectBeanManager
-
getQueryManager
- Returns:
- the
HstQueryManager
backed by thegetSession()
- Throws:
IllegalStateException
- if the application is unable to provide a HstQueryManager
-
getQueryManager
- Parameters:
session
- theSession
to create thisObjectBeanManager
with- Returns:
- the
HstQueryManager
backed by thesession
- Throws:
IllegalStateException
- if the application is unable to provide a HstQueryManager
-
getHeadContributableMap
Map<String,HeadContributable> getHeadContributableMap()Return a non-null unmodifiable map ofHeadContributable
objects keyed by their contributor names.- Returns:
- a non-null unmodifiable map of
HeadContributable
objects keyed by their contributor names
-
getHeadContributable
ReturnHeadContributable
object by thename
if found. null if not found.- Parameters:
name
- the name of the logical head contributor.- Returns:
HeadContributable
object by thename
if found. null if not found
-
setHeadContributable
Set aHeadContributable
object by thename
.- Parameters:
name
- the name of the logical head contributor.headContributable
-HeadContributable
object
-
getContentTypes
ContentTypes getContentTypes()- Returns:
- Return
ContentTypes
within current request
-
isSearchEngineOrBotRequest
boolean isSearchEngineOrBotRequest()Return true if it was determined that the request comes from a search engine.- Returns:
- true if it was determined that the request comes from a search engine
-