org.hippoecm.hst.core.request
Interface HstRequestContext

All Known Subinterfaces:
HstMutablePortletRequestContext, HstMutableRequestContext, HstPortletRequestContext
All Known Implementing Classes:
HstPortletRequestContextImpl, HstRequestContextImpl, MockHstRequestContext

public interface HstRequestContext

HstRequestContext provides repository content context and page/components configuration context. Also, HstRequestContext is shared among all the HstComponent windows in a request lifecycle.

Version:
$Id: HstRequestContext.java 35818 2012-08-21 19:08:19Z aschrijvers $

Method Summary
 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()
           The tags that will be used to render container items.
 ContainerConfiguration getContainerConfiguration()
          Returns the container configuration
 HstContainerURLProvider getContainerURLProvider()
          Returns the HstContainerURLProvider to create HstContainerURLs
 ContextCredentialsProvider getContextCredentialsProvider()
          Returns the context credentials provider
 String getContextNamespace()
          Returns the context namespace.
 String getEmbeddingContextPath()
          Returns the contextPath of the embedding application for an embedded request, otherwise null
 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)
           a mount with Mount.getAlias() equal to alias and one of its Mount.getTypes() equal to type.
 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.
 String getRenderHost()
           
 ResolvedMount getResolvedEmbeddingMount()
          Returns the ResolvedMount to be used for link rewriting when this request is embedded, otherwise null
 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.
 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.
 String getTargetComponentPath()
          Returns a target component path relative to HstComponentConfiguration of the {@link #getResolvedSiteMapItem().
 HstURLFactory getURLFactory()
          Returns the HstURLFactory to create HstURLs
 VirtualHost getVirtualHost()
          Returns the matched virtual host object
 boolean isCmsRequest()
           
 boolean isEmbeddedRequest()
          Returns true if this request is embedded and link rewriting needs to use the getResolvedEmbeddingMount() for the target Mount path and context path (if to be included).
 boolean isFullyQualifiedURLs()
           
 boolean isPortletContext()
          Returns true if invoked from a Portlet.
 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.
 

Method Detail

getServletContext

javax.servlet.ServletContext getServletContext()
Returns the ServletContext for this request

Returns:
the ServletContext for this request

getServletRequest

javax.servlet.http.HttpServletRequest getServletRequest()
Returns the current HttpServletRequest

Returns:
the current HttpServletRequest

getServletResponse

javax.servlet.http.HttpServletResponse getServletResponse()
Returns the current HttpServletResponse

Returns:
the current HttpServletResponse

getSession

javax.jcr.Session getSession()
                             throws javax.jcr.LoginException,
                                    javax.jcr.RepositoryException
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:
javax.jcr.LoginException
javax.jcr.RepositoryException

getSession

javax.jcr.Session getSession(boolean create)
                             throws javax.jcr.LoginException,
                                    javax.jcr.RepositoryException
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 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.

Returns:
a session, which is normally retrieved from a session pooling repository
Throws:
javax.jcr.LoginException
javax.jcr.RepositoryException

getResolvedMount

ResolvedMount getResolvedMount()
Returns the ResolvedMount for this request

Returns:
the ResolvedMount for this request

getResolvedSiteMapItem

ResolvedSiteMapItem getResolvedSiteMapItem()
Returns the ResolvedSiteMapItem for this request

Returns:
the resolvedSiteMapItem for this request

getTargetComponentPath

String getTargetComponentPath()
Returns a target component path relative to HstComponentConfiguration of the {@link #getResolvedSiteMapItem(). If not null the targeted sub component configuration will be used as root component for this request instead.


isPreview

boolean isPreview()
Returns:
true when this request is matched to a preview site
See Also:
Mount.isPreview()

getContextNamespace

String getContextNamespace()
Returns the context namespace. If there are multiple HstContainer based applications, it could be necessary to separate the component window's namespaces. This context namespace can be used for the purpose.

Returns:

getBaseURL

HstContainerURL getBaseURL()
Returns the base container URL (HstContainerURL ) of the current request lifecycle.

Returns:
HstContainerURL

getURLFactory

HstURLFactory getURLFactory()
Returns the HstURLFactory to create HstURLs

Returns:
HstURLFactory

getContainerURLProvider

HstContainerURLProvider getContainerURLProvider()
Returns the HstContainerURLProvider to create HstContainerURLs

Returns:
HstContainerURLProvider

getSiteMapMatcher

HstSiteMapMatcher getSiteMapMatcher()
Returns the HstSiteMapMatcher to be able to match a path to a sitemap item

Returns:
HstSiteMapMatcher

getHstLinkCreator

HstLinkCreator getHstLinkCreator()
Returns the HstLinkCreator to create navigational links

Returns:
HstLinkCreator

getHstSiteMenus

HstSiteMenus getHstSiteMenus()
Returns:
the HstSiteMenus

getHstQueryManagerFactory

HstQueryManagerFactory getHstQueryManagerFactory()
Returns a HstQueryManagerFactory instance responsible for creating a query manager

Returns:
HstQueryManagerFactory

getParameterInfoProxyFactory

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

Returns:
the HstParameterInfoProxyFactory

setAttribute

void setAttribute(String name,
                  Object object)
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 name
object - attribute value

getAttribute

Object getAttribute(String name)
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

void removeAttribute(String name)
Removes the attribute by the attribute name.


getAttributeNames

Enumeration<String> getAttributeNames()
Enumerates the attribute names


getAttributes

Map<String,Object> getAttributes()
Returns attribute map which is unmodifiable. So, do not try to put or remove items directly from the returned map.

Returns:

getVirtualHost

VirtualHost getVirtualHost()
Returns the matched virtual host object

Returns:

getContainerConfiguration

ContainerConfiguration getContainerConfiguration()
Returns the container configuration

Returns:

isEmbeddedRequest

boolean isEmbeddedRequest()
Returns true if this request is embedded and link rewriting needs to use the getResolvedEmbeddingMount() for the target Mount path and context path (if to be included).


isCmsRequest

boolean isCmsRequest()
Returns:
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 cms

getEmbeddingContextPath

String getEmbeddingContextPath()
Returns the contextPath of the embedding application for an embedded request, otherwise null

See Also:
isEmbeddedRequest()

getResolvedEmbeddingMount

ResolvedMount getResolvedEmbeddingMount()
Returns the ResolvedMount to be used for link rewriting when this request is embedded, otherwise null

See Also:
isEmbeddedRequest()

isPortletContext

boolean isPortletContext()
Returns true if invoked from a Portlet. If true, this instance will also implement HstPortletRequestContext.


getContextCredentialsProvider

ContextCredentialsProvider getContextCredentialsProvider()
Returns the context credentials provider

Returns:

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

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. 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!

Parameters:
alias - the alias the found Mount or XXX in hst:mountXXX property
Returns:
a mount with Mount.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.
Throws:
IllegalArgumentException - when alias is null

getMount

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.

Parameters:
alias - the alias the found Mount or or XXX in hst:mountXXX property
type - the type the found Mount should have
Returns:
a mount with Mount.getAlias() equal to alias or mappedAlias and one of its Mount.getTypes() equal to type. null if there is no suitable mount.
Throws:
IllegalArgumentException - when alias or type is null

getComponentFilterTags

Set<String> getComponentFilterTags()

The tags that will be used to render container items.

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.

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


Copyright © 2008-2012 Hippo. All Rights Reserved.