Interface HstSiteMapItem

All Known Subinterfaces:
InternalHstSiteMapItem

public interface HstSiteMapItem
A 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.

  • Method Details

    • getId

      String getId()
      The id of a HstSiteMapItem is mandatory and must be unique within its containing HstSiteMap because HstSiteMap.getSiteMapItemById(String) must uniquely return a HstSiteMapItem.
      Returns:
      the id of this HstSiteMapItem
    • getRefId

      String getRefId()
      The refId of a 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.
      Returns:
      the refId of this HstSiteMapItem or null when no refId is defined on the HstSiteMapItem
    • getApplicationId

      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 HstSiteMapItems from its parent

      Returns:
      the application id of this HstSiteMapItem or null in case no applicationId is defined
    • getQualifiedId

      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
      Returns:
      the qualified id of this HstSiteMapItem
    • getValue

      String getValue()
      Returns the logical path element of this 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)
      Returns:
      the value of this SiteMapItem which represents the logical path element for this SiteMapItem
    • getPageTitle

      String getPageTitle()
      Returns:
      the page title for this HstSiteMapItem or null if not configured
    • isWildCard

      boolean isWildCard()
      Returns a boolean indicating whether this HstSiteMapItem represents a path with a wildcard value *
      Returns:
      true if this HstSiteMapItem represents *
    • containsWildCard

      boolean containsWildCard()
      Returns:
      true when this HstSiteMapItem represents a path that contains a * but is not equals to a * (for example *.html)
    • isAny

      boolean isAny()
      Returns a boolean indicating whether this HstSiteMapItem represents a path with a any value **
      Returns:
      true if this HstSiteMapItem represents **
    • containsAny

      boolean containsAny()
      Returns:
      true when this HstSiteMapItem represents a path that contains ** but is not equals to ** (for example **.html)
    • isExplicitElement

      boolean isExplicitElement()
      Returns:
      true when isWildCard(), isAny(), containsWildCard() and containsAny() all return false
    • isExplicitPath

      boolean isExplicitPath()
      Returns:
      true when this item plus all its ancestor HstSiteMapItems return true for isExplicitElement()
    • getRelativeContentPath

      String getRelativeContentPath()
      This method returns a content path, relative to the Mount.getContentPath(). This value can contain property placeholders, like ${1}/${2}, which should be resolved in the ResolvedSiteMapItem.getRelativeContentPath()
      Returns:
      the content path relative to the Mount.getContentPath()
    • getComponentConfigurationId

      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. This component configuration can be the root of a component configuration tree, see HstComponentConfiguration.
      Returns:
      the componentConfigurationId for this SiteMapItem or null
    • getComponentConfigurationIdMappings

      Map<String,String> getComponentConfigurationIdMappings()
      Returns:
      the Map of keys to more specific configurationId's and null if there are no mappings defined
      See Also:
    • isAuthenticated

      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.

      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.

      Returns:
      true if the sitemap item is authenticated.
    • getRoles

      Set<String> getRoles()
      Returns the roles that are allowed to access this sitemap item when 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.

      Returns:
      The set of roles that are allowed to access this sitemap item. When no roles defined, the roles from the parent item are inherited. If none of the parent items have a role defined, an empty set is returned
    • getUsers

      Set<String> getUsers()
      Returns the users that are allowed to access this sitemap item when 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.

      Returns:
      The set of users that are allowed to access this sitemap item. When no users defined, the users from the parent item are inherited. If none of the parent items have a user defined, an empty set is returned
    • isExcludedForLinkRewriting

      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

      Returns:
      true when this sitemap item should be ignored for linkrewriting
    • getChildren

      List<HstSiteMapItem> getChildren()
      Returns a 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 configuration
      Returns:
      the List of HstSiteMapItem children. If there are no children, an empty list is returned
    • getChild

      HstSiteMapItem getChild(String value)
      Return the child HstSiteMapItem that has the corresponding value (getValue() ) and null otherwise
      Parameters:
      value - the value of the child HstSiteMapItem as it would be return by getValue()
      Returns:
      Returns the HstSiteMapItem object corresponding to the unique value and null if no HstSiteMapItem exists with this value in this HstSiteMapItem object.
    • getParameter

      String getParameter(String name)
      A HstSiteMapItem can contain a Map of parameters. These parameters can be accessed from 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)

      Parameters:
      name - the name of the parameter
      Returns:
      the value of the parameter or null when not present
    • getLocalParameter

      String getLocalParameter(String name)
      see getParameter(String), only this method returns parameters without inheritance
      Parameters:
      name - the name of the parameter
      Returns:
      the value of the parameter or null when not present
    • getParameters

      Map<String,String> getParameters()
      See 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()

      Returns:
      the Map of parameters contained in this HstSiteMapItem. If no parameters present, and empty map is returned
    • getLocalParameters

      Map<String,String> getLocalParameters()
      see getParameters(), only this method returns parameters (unmodifiable map) without inheritance
      Returns:
      the Map of parameters contained in this HstSiteMapItem. If no parameters present, and empty map is returned
    • getParentItem

      HstSiteMapItem getParentItem()
      Returns parent HstSiteMapItem and null when the item does not have a parent (in other words, it is a root HstSiteMapItem)
      Returns:
      the parent HstSiteMapItem and null when the item does not have a parent
    • getHstSiteMap

      HstSiteMap getHstSiteMap()
      Return the HstSiteMap that is the container of this HstSiteMapItem
      Returns:
      the HstSiteMap that is the container of this HstSiteMapItem
    • getStatusCode

      int getStatusCode()
      A 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.
      Returns:
      if a status code is set, return this, otherwise 0
    • getErrorCode

      int getErrorCode()
      A 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.
      Returns:
      if an error code is set, return this, otherwise 0
    • getNamedPipeline

      String getNamedPipeline()
      the namedPipeline for this sitemapItem or 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 own
      Returns:
      the namedPipeline for this sitemapItem or null when it does not contain one.
    • getLocale

      String getLocale()
      the locale for this sitemapItem or 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.
      Returns:
      the locale for this sitemapItem or null when it does not contain one.
    • getSiteMapItemHandlerConfiguration

      @Deprecated 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
      Parameters:
      handlerId -
      Returns:
      the HstSiteMapItemHandlerConfiguration for handlerId or null if no handler present for handlerId
    • getSiteMapItemHandlerConfigurations

      @Deprecated 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

      The List of HstSiteMapItemHandlerConfigurations and an empty list if this SiteMapItem does not contain HstSiteMapItemHandlerConfigurations.
      Note that HstSiteMapItemHandlerConfigurations 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

      Returns:
      The List of HstSiteMapItemHandlerConfigurations and an empty list if this SiteMapItem does not contain HstSiteMapItemHandlerConfigurations
    • isCacheable

      boolean isCacheable()
      Returns:
      true if rendering / resource requests can have their entire page http responses cached.
    • getScheme

      String getScheme()
      The scheme of a site map item specifies which scheme is to be used for serving this site map item. The value of this property is derived in the following order:
      1. If the hst:scheme property is set for this site map item, then that is used
      2. If this site map item has a parent, it will use the parent's scheme
      3. If the mount that this site map item belongs to has a scheme set, then that is used

      If a site map item has an hst:scheme property, but it is left blank then the scheme defaults to VirtualHosts.DEFAULT_SCHEME

      Returns:
      the scheme of this site map item
    • isSchemeAgnostic

      boolean isSchemeAgnostic()
      If a HstSiteMapItem is scheme agnostic, the request gets served regardless whether it is http or https
      Returns:
      true when this HstSiteMapItem is scheme agnostic
    • getSchemeNotMatchingResponseCode

      int 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:

      1. 200 : no behavior, ignored
      2. 301 : when request has different scheme than getScheme(), permanent redirect to the correct scheme is done
      3. 302 | 303 | 307 : when request has different scheme than getScheme(), temporal redirect to the correct scheme is done
      4. 403 : when request has different scheme than getScheme(), a page forbidden is returned
      5. 404 : when request has different scheme than getScheme(), a page not found is returned

      Any other response code than above will result in inheriting the response code from parent HstSiteMapItem or Mount

    • getResourceBundleIds

      String[] getResourceBundleIds()
      Returns:
      resource bundle IDs for this sitemapitem and descendants to use, for example { "org.example.resources.MyResources" }, or an empty array when not configured on this HstSiteMapItem and empty from ancestor HstSiteMapItem or when root sitemapitem from Mount.getDefaultResourceBundleIds()
    • isContainerResource

      boolean isContainerResource()
      A sitemap item that should serve (a) container resource(s) can be marked to do so by returning 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.
      Returns:
      true when the this sitemap item should serve(a) container resource(s).
    • isHiddenInChannelManager

      boolean isHiddenInChannelManager()
      Returns:
      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 either
    • isMarkedDeleted

      boolean isMarkedDeleted()
      Returns 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.
      Returns:
      true when this HstSiteMapItem is marked as deleted.
    • getResponseHeaders

      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

      Returns:
      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.
    • getHstSiteMapItemHandlers

      List<HstSiteMapItemHandler> getHstSiteMapItemHandlers()
      Returns:
      the list of HstSiteMapItemHandlers for this HstSiteMapItem and an empty list if none present