Interface HstRequestContext

All Superinterfaces:
ModelContributable
All Known Subinterfaces:
HstMutableRequestContext

public interface HstRequestContext extends ModelContributable
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$
  • 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

      Session getSession(boolean create) throws LoginException, 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:
      LoginException
      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
    • 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 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
      Throws:
      IllegalStateException - when this method is invoked while there is no ResolvedSiteMapItem available on this HstRequestContext via getResolvedSiteMapItem()
    • 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:
      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

      Returns the type of this request. In case the returned type is HstRequestContext.HstRequestType.CHANNEL_MGR_PREVIEW then isChannelManagerPreviewRequest() is always true as well. Likewise if HstRequestContext.HstRequestType.CHANNEL_MGR_REST is returned, then isChannelManagerRestRequest() will also return true

      Returns:
      the HstRequestType of this request, or null 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() is true, this method isRenderingHistory() 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

      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()

      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 HstComponentWindows 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 of HstComponentWindowFilters 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 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
    • getObjectConverter

      ObjectConverter getObjectConverter()
      Returns the 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 converter
      Returns:
      the ObjectConverter for the current HstRequestContext
    • getSiteContentBasePath

      String getSiteContentBasePath()
      Returns:
      the root content path relative to the root node for the ResolvedMount belonging to the current HttpServletRequest. The path never starts with a "/" as it is relative to the root node.
    • getSiteContentBaseBean

      HippoBean getSiteContentBaseBean()
      Returns the siteContentBaseBean 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()
      Returns:
      the HippoBean belonging to for getSiteContentBasePath()
    • getContentBean

      HippoBean getContentBean()
      Returns the content 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()
      Returns:
      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().
    • getContentBean

      <T extends HippoBean> T getContentBean(Class<T> beanMappingClass)
      Returns same as getContentBean() but if the found HippoBean is not of type beanMappingClass, then null is returned.
      Returns:
      HippoBean of type beanMappingClass or null
      See Also:
    • getObjectBeanManager

      ObjectBeanManager getObjectBeanManager() throws IllegalStateException
      Returns:
      a ObjectBeanManager instance for the current HstRequestContext backed by the getSession()
      Throws:
      IllegalStateException - if the application is unable to provide a ObjectBeanManager
    • getObjectBeanManager

      ObjectBeanManager getObjectBeanManager(Session session) throws IllegalStateException
      Parameters:
      session - the Session to create this ObjectBeanManager with
      Returns:
      a ObjectBeanManager instance for the current HstRequestContext backed by the session
      Throws:
      IllegalStateException - if the application is unable to provide a ObjectBeanManager
    • getQueryManager

      HstQueryManager getQueryManager() throws IllegalStateException
      Returns:
      the HstQueryManager backed by the getSession()
      Throws:
      IllegalStateException - if the application is unable to provide a HstQueryManager
    • getQueryManager

      HstQueryManager getQueryManager(Session session) throws IllegalStateException
      Parameters:
      session - the Session to create this ObjectBeanManager with
      Returns:
      the HstQueryManager backed by the session
      Throws:
      IllegalStateException - if the application is unable to provide a HstQueryManager
    • getHeadContributableMap

      Map<String,HeadContributable> getHeadContributableMap()
      Return a non-null unmodifiable map of HeadContributable objects keyed by their contributor names.
      Returns:
      a non-null unmodifiable map of HeadContributable objects keyed by their contributor names
    • getHeadContributable

      HeadContributable getHeadContributable(String name)
      Return HeadContributable object by the name if found. null if not found.
      Parameters:
      name - the name of the logical head contributor.
      Returns:
      HeadContributable object by the name if found. null if not found
    • setHeadContributable

      void setHeadContributable(String name, HeadContributable headContributable)
      Set a HeadContributable object by the name.
      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