public interface HstRequestContext
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String name)
Retrieve the attribute value by the attribute name.
|
Enumeration<String> |
getAttributeNames()
Enumerates the attribute names
|
Map<String,Object> |
getAttributes()
Returns attribute map which is unmodifiable.
|
HstContainerURL |
getBaseURL()
Returns the base container URL (
HstContainerURL ) of the current request lifecycle. |
Set<String> |
getComponentFilterTags()
Expert: The tags that will be used to render container items.
|
List<HstComponentWindowFilter> |
getComponentWindowFilters()
Expert: Option to add filters to the
HstRequestContext . |
ContainerConfiguration |
getContainerConfiguration() |
HstContainerURLProvider |
getContainerURLProvider()
Returns the
HstContainerURLProvider to create HstContainerURLs |
HippoBean |
getContentBean()
Returns the content
HippoBean for this request. |
<T extends HippoBean> |
getContentBean(Class<T> beanMappingClass)
Returns same as
getContentBean() but if the found HippoBean is not of type
beanMappingClass , then null is returned. |
ContentBeansTool |
getContentBeansTool() |
ContextCredentialsProvider |
getContextCredentialsProvider()
Returns the context credentials provider
|
HstLinkCreator |
getHstLinkCreator()
Returns the
HstLinkCreator to create navigational links |
HstQueryManagerFactory |
getHstQueryManagerFactory()
Returns a
HstQueryManagerFactory instance responsible for creating a query manager |
HstSiteMenus |
getHstSiteMenus() |
Enumeration<Locale> |
getLocales()
Returns an Enumeration of Locale objects
|
Mount |
getMount(String alias)
a mount with
Mount.getAlias() equal to alias and at least one common type with the mount from the current request. |
Mount |
getMount(String alias,
String type)
|
ObjectBeanManager |
getObjectBeanManager() |
ObjectBeanManager |
getObjectBeanManager(javax.jcr.Session session) |
ObjectConverter |
getObjectConverter()
Returns the
ObjectConverter for the current HstRequestContext . |
HstParameterInfoProxyFactory |
getParameterInfoProxyFactory()
Expert: Returns
HstParameterInfoProxyFactory to create a proxy for an interface that is referred to by a ParametersInfo annotation
on a HstComponent
annotated interface getters |
String |
getPathSuffix()
Returns the path suffix from the resolved site map item.
|
Locale |
getPreferredLocale()
Gets the preferred locale associated with this request.
|
HstQueryManager |
getQueryManager() |
HstQueryManager |
getQueryManager(javax.jcr.Session session) |
String |
getRenderHost() |
ResolvedMount |
getResolvedMount()
Returns the
ResolvedMount for this request |
ResolvedSiteMapItem |
getResolvedSiteMapItem()
Returns the
ResolvedSiteMapItem for this request |
javax.servlet.ServletContext |
getServletContext()
Returns the ServletContext for this request
|
javax.servlet.http.HttpServletRequest |
getServletRequest()
Returns the current HttpServletRequest
|
javax.servlet.http.HttpServletResponse |
getServletResponse()
Returns the current HttpServletResponse
|
javax.jcr.Session |
getSession()
Returns a session which is normally retrieved from a session pooling repository.
|
javax.jcr.Session |
getSession(boolean create)
Returns a session which can be retrieved from a session pooling repository.
|
HippoBean |
getSiteContentBaseBean()
Returns the siteContentBaseBean
HippoBean for this request. |
String |
getSiteContentBasePath() |
HstSiteMapMatcher |
getSiteMapMatcher()
Returns the
HstSiteMapMatcher to be able to match a path to a sitemap item |
Subject |
getSubject()
Gets the subject associated with the authorized entity.
|
HstURLFactory |
getURLFactory()
Returns the
HstURLFactory to create HstURLs |
VirtualHost |
getVirtualHost()
Returns the matched virtual host object
|
boolean |
isCmsRequest() |
boolean |
isFullyQualifiedURLs() |
boolean |
isPreview() |
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.
|
javax.servlet.ServletContext getServletContext()
javax.servlet.http.HttpServletRequest getServletRequest()
javax.servlet.http.HttpServletResponse getServletResponse()
javax.jcr.Session getSession() throws javax.jcr.LoginException, javax.jcr.RepositoryException
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.
javax.jcr.LoginException
javax.jcr.RepositoryException
javax.jcr.Session getSession(boolean create) throws javax.jcr.LoginException, javax.jcr.RepositoryException
Returns the current javax.jcr.Session
associated with this requestContext or, if if there is no
current JCR session and create
is true, returns
a new JCR session.
If create
is false
and the requestContext has no javax.jcr.Session
,
this method returns null
.
javax.jcr.LoginException
javax.jcr.RepositoryException
ResolvedMount getResolvedMount()
ResolvedMount
for this requestResolvedMount
for this requestResolvedSiteMapItem getResolvedSiteMapItem()
ResolvedSiteMapItem
for this requestboolean isPreview()
true
when this request is matched to a preview siteMount.isPreview()
HstContainerURL getBaseURL()
HstContainerURL
) of the current request lifecycle.HstURLFactory getURLFactory()
HstURLFactory
to create HstURLsHstContainerURLProvider getContainerURLProvider()
HstContainerURLProvider
to create HstContainerURLsHstSiteMapMatcher getSiteMapMatcher()
HstSiteMapMatcher
to be able to match a path to a sitemap itemHstLinkCreator getHstLinkCreator()
HstLinkCreator
to create navigational linksHstSiteMenus getHstSiteMenus()
IllegalStateException
- when this method is invoked while there is no ResolvedSiteMapItem
available
on this HstRequestContext
via getResolvedSiteMapItem()
HstQueryManagerFactory getHstQueryManagerFactory()
HstQueryManagerFactory
instance responsible for creating a query managerHstParameterInfoProxyFactory getParameterInfoProxyFactory()
HstParameterInfoProxyFactory
to create a proxy for an interface that is referred to by a ParametersInfo
annotation
on a HstComponent
annotated interface gettersHstParameterInfoProxyFactory
void setAttribute(String name, Object object)
name
- attribute nameobject
- attribute valueObject getAttribute(String name)
void removeAttribute(String name)
Enumeration<String> getAttributeNames()
Map<String,Object> getAttributes()
VirtualHost getVirtualHost()
ContainerConfiguration getContainerConfiguration()
ContainerConfiguration
boolean isCmsRequest()
true
when the request is from a cms context: This can be some REST call from the cms, or
a channel preview request inside the cms or over the HOST of the cmsContextCredentialsProvider getContextCredentialsProvider()
Subject getSubject()
Locale getPreferredLocale()
Enumeration<Locale> getLocales()
String getPathSuffix()
null
if there is no path suffixMount getMount(String alias)
a mount with Mount.getAlias()
equal to alias
and at least one common type with the mount from the current request. Thus, at least
one of the types of the found Mount.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, this
Mount
has precedence. If there is no primary type match, we'll return the mount that has most types in common
There will be looked if the Mount
of the current HstRequestContext
has a property that is called hst:mountXXX
where XXX
is equal to alias
. If so, there will be tried
to return a Mount
that has an alias equal to the value of this mappedAlias property hst:mountXXX
.
If there cannot be found a Mount
for via a mapped hst:mountXXX
property, there will be looked for a Mount
with
which has Mount.getAlias()
equal to alias
.
Thus a mapped alias has precedence!
alias
- the alias the found Mount
or XXX in hst:mountXXX propertyMount.getAlias()
equal to alias
or mappedAlias and at least one common type with the mount from the current request. null
if there is no suitable mount.IllegalArgumentException
- when alias
is null
Mount getMount(String alias, String type)
a mount with Mount.getAlias()
equal to alias
and one of its Mount.getTypes()
equal to type
.
There will be looked if the Mount
of the current HstRequestContext
has a property that is called hst:mountXXX
where XXX
is equal to alias
.
If so, there will be tried to return a Mount
that has an alias equal to the value of this mappedAlias property hst:mountXXX
. If there cannot be found a Mount
for via a mapped hst:mountXXX
property,
there will be looked for a Mount
with which has Mount.getAlias()
equal to alias
.
alias
- the alias the found Mount
or or XXX in hst:mountXXX propertytype
- the type the found Mount
should haveMount.getAlias()
equal to alias
or mappedAlias and one of its Mount.getTypes()
equal to type
. null
if there is no suitable mount.IllegalArgumentException
- when alias
or type
is null
Set<String> 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 specific HstComponentWindow
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.
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
List
of HstComponentWindowFilter
s and if none present, return a empty Listboolean isFullyQualifiedURLs()
true
when all URLs must be fully qualified, ie, including scheme, domain and portnumber (if present)String getRenderHost()
null
when no specific render host is defined. Typically,
there is only a render host when the request originated from the CMSContentBeansTool getContentBeansTool()
ContentBeansTool
instance. Note that the ContentBeansTool
instance is an object shared by
multiple threads. Invoking this method before the ContentBeansTool
is set on the HstRequestContext
results in null
being returned. As of 2.26.xx, this is for example the case when invoking
getContentBeansTool()
during execution of a HstSiteMapItemHandler
ObjectConverter getObjectConverter()
ObjectConverter
for the current HstRequestContext
. Note the returned ObjectConverter
is likely to be a different one than returned vua getContentBeansTool().getObjectConverter()
because the latter is a non-caching object converter while this getObjectConverter()
returns possibly
a caching object converterObjectConverter
for the current HstRequestContext
String getSiteContentBasePath()
ResolvedMount
belonging to the current
HttpServletRequest
. The path never starts with a "/" as it is relative to the root node.HippoBean getSiteContentBaseBean()
HippoBean
for this request. After first retrieval, the bean is cached and
the same instance will be returned when calling getSiteContentBaseBean()
multiple times. The backing jcr
Node
is fetched through jcr Session getSession()
HippoBean
belonging to for getSiteContentBasePath()
HippoBean getContentBean()
HippoBean
for this request. After first retrieval, the content bean is cached and
the same instance will be returned when calling getContentBean()
multiple times. The backing jcr
Node
is fetched through jcr Session getSession()
HippoBean
belonging to the ResolvedSiteMapItem
or
null
HstSiteMapItem.getRelativeContentPath()
is null
or when there is no content (jcr node) to be found at HstSiteMapItem.getRelativeContentPath()
.<T extends HippoBean> T getContentBean(Class<T> beanMappingClass)
getContentBean()
but if the found HippoBean
is not of type
beanMappingClass
, then null
is returned.HippoBean
of type beanMappingClass
or null
getContentBean()
ObjectBeanManager getObjectBeanManager() throws IllegalStateException
ObjectBeanManager
instance for the current HstRequestContext
backed by the
getSession()
IllegalStateException
- if the application is unable to provide a ObjectBeanManagerObjectBeanManager getObjectBeanManager(javax.jcr.Session session) throws IllegalStateException
session
- the Session
to create this ObjectBeanManager
withObjectBeanManager
instance for the current HstRequestContext
backed by the
session
IllegalStateException
- if the application is unable to provide a ObjectBeanManagerHstQueryManager getQueryManager() throws IllegalStateException
HstQueryManager
backed by the
getSession()
IllegalStateException
- if the application is unable to provide a HstQueryManagerHstQueryManager getQueryManager(javax.jcr.Session session) throws IllegalStateException
session
- the Session
to create this ObjectBeanManager
withHstQueryManager
backed by the
session
IllegalStateException
- if the application is unable to provide a HstQueryManagerCopyright © 2008–2017 Hippo B.V. (http://www.onehippo.com). All rights reserved.