For page requests, a request-scoped /atg/endeca/assembler/SiteState
component must be resolved. This component contains the siteId
for the current request as well as the page URI, or contentPath
, being requested. Page requests begin when a ContentInclude
object is passed to the NucleusAssembler
component, after which the ContentIncludeHandler
is invoked to resolve the SiteState
component and the page content.
The SiteState
component has the following properties:
siteId
: The Guided Search Site ID for the site that the current request resolves to, for example,/storeSiteUS
. Note that the Guided Search Site ID identifies the correct site within the EAC application. This ID is distinct and different from the site ID that is part of a site’s definition in the Site repository. Each site in the Site repository will have a site ID. It may also have a corresponding Guided Search Site ID. The purpose of the Guided Search Site ID property is to create a mapping between a site definition in the Site repository and its corresponding site in the EAC application.contentPath
: The path to the page for the current request, for example,/browse
. This path is relative to the site specified in thesiteId
property.properties
: This map provides a storage mechanism for additional properties you may want to include with yourSiteState
component. Out of the box, it is empty.
To resolve the ContentIncludeHandler
component’s reference to the SiteState
component, Nucleus calls the createSiteState()
method of the com.endeca.infront.site.SiteStateBuilder
class. The SiteStateBuilder
class is a factory class that constructs a SiteState
component for the current request. To create the SiteState
component, the SiteStateBuilder
class determines both the site context and the contentPath
of the Experience Manager page being requested, as described below.
To establish the site context, the SiteStateBuilder
component uses a series of parsers. Each parser contains logic that determines the Guided Search site ID for the current request and then returns a SiteState
object with a populated siteId
property. A parser must implement the atg.endeca.assembler.multisite.SiteStateParser
interface, which has the following core method:
public interface SiteStateParser { public SiteState parseSiteState(HttpServletRequest request, SiteManager siteManager); }
The SiteStateBuilder.siteStateParsers
property contains a list of parsers that are executed in the configured order to resolve the site context. Out of the box, this property is set to a single parser, the /atg/endeca/assembler/multisite/SiteStateParser
component, which looks at the site context for the request and extracts the Guided Search Site ID from that site’s definition in the Site repository.
In the event that the parsers defined in the siteStateParsers
property fail to determine a Guided Search site ID and return a SiteState
object, the SiteStateBuilder.defaultSiteStateParser
property references a default SiteStateParser
. Out of the box, the defaultSiteStateParser
property references the /atg/endeca/assembler/multisite/DefaultSiteStateParser
component. This component uses the default site configured for the EAC application to determine the site context. Note that it is the Experience Manager administrator’s responsibility to specify the default site when creating an EAC application. If a default site is not specified for an EAC application, one of the following scenarios occurs:
If there is only one site, then that site is used as the default.
If there are multiple sites in the EAC application, the
SiteState.siteId
property will contain a value of@error:siteNotFound
, which leads the Assembler to return aFileNotFound
error.
Assuming one of the parsers executed successfully, the result is a SiteState
object with the Guided Search site ID stored in its siteId
property.
After determining the site context, the SiteStateBuilder
class invokes the /atg/endeca/assembler/multisite/ContentPathTranslator
component specified in the SiteStateBuilder.contentPathTranslator
property. This component translates the original request URL into an Experience Manager content path, for example, /browse
. To calculate the content path, the ContentPathTranslator
component calls the AssemblerTools.getContentPath()
method. This method encapsulates the Oracle Commerce Core Platform’s logic for calculating the content path from the request URL (note that this logic could be replaced by a different application-specific class and method). See the Calculating the Content Path from the Page Request URL section for details on how the getContentPath()
method works.
After the SiteStateParser
and ContentPathTranslator
components have executed, a SiteState
component exists for the current request and it has the site context and content path information the ContentIncludeHandler
needs to locate the correct content in the Experience Manager pages hierarchy.