The Oracle ATG Web Commerce installation provides the following SiteContextRuleFilter components for identifying a site:
RequestParameterRuleFilter: Evaluates query parameters that supply the site ID and specify whether that site should persist for the remainder of the current session.
URLPatternMatchingRuleFilter: Encapsulates rules for obtaining a site ID from the request URL.
DefaultSiteRuleFilter: Returns the server’s default site ID.
RequestParameterRuleFilter
Based on the class atg.multisite.PushedSiteParamFilter, the component /atg/multisite/RequestParameterRuleFilter is the first rule filter to execute. This filter processes request query parameters that set the current site, and specify it as a sticky site that persists throughout the session of that request. This filter is typically useful for testing and previewing sites that are under development; it should be disabled for production sites.
RequestParameterRuleFilter checks the request URL for two query parameters:
pushSiteis set to a site ID, which is returned by the rule filter’sfilter()method.stickySite, if set tosetSite, makes thepushSite-specified site sticky for the current session. Unless explicitly reset or unset, the sticky site is used for all subsequent requests during that session.
A sticky site remains valid for the current session until another request URL sets one of the following query parameters:
pushSitespecifies another site ID, which becomes the current site. IfstickySiteis also set tosetSite, this SiteContext becomes the new sticky site.stickySiteis set tounsetSite. This unsets the sticky site, and the RequestParameterRuleFilter returns null. The SiteContextPipelineServlet executes subsequent rule filters in itsruleFiltersproperty until one returns a valid site.
RequestParameterRuleFilter is enabled through two properties:
enabledspecifies whether the filter is active within the filter chain. If set tofalse, SiteContextPipelineServlet skips over this filter when processing a request. By default, this property is set totrue.enableStickySitedisables sticky site functionality if set tofalse. The filter remains active and supports use of thepushSitequery parameter; it ignores thestickySitequery parameter. By default, this property is set tofalse.Note: Sticky site functionality is always enabled on preview servers through the SiteURLManager property
autoAppendStickySiteParams. For more about the SiteURLManager, see Multisite URL Management later in this chapter.
If desired, you can change the names of the query parameters that RequestParameterRuleFilter expects by setting these properties:
stickySiteParamName
Note: Changing these properties on an asset management or preview server might disrupt preview functionality.
URLPatternMatchingRuleFilter
Based on the class atg.multisite.SiteContextRuleFilter, the filter component /atg/multisite/URLPatternMatchingRulefilter encapsulates rules for obtaining a site ID from a request URL. The filter implements two algorithms for determining the site ID:
Looks up the request URL in a map that is set in the filter’s
URLsproperty, which pairs URLs with site IDs. If the URL maps to a virtual context room, thegetPatternMatchingURLForRequestmethod returns the portion of the URL containing the domain, port an servlet pathThe
URLsproperty setting lets a specific server substitute URL-to-site mappings that are otherwise set and managed by the SiteURLManager. This is generally useful for testing purposes, and is not typically used in a production environment.Passes the request URL to the method
SiteURLManager.getSiteIdForURL(). This method obtains a site ID from the Multisite URL Management system, described elsewhere in this chapter.
Several Boolean properties determine whether the URLPatternMatchingRuleFilter is enabled and how it executes:
Property | Description |
|---|---|
| The filter is enabled. |
| Use the |
| Pass the request URL to the SiteURLManager for processing. |
By default, all properties are set to true.
URLPatternMatchingRuleFilter also checks the request for the context parameter atg.multisite.URLPatternMatchingEnabled, which the application’s web.xml file can set to true or false. If the parameter is set to false, the filter does not execute and returns null to the SiteContextPipelineServlet. If web.xml omits this context parameter, the URLPatternMatchingRuleFilter behaves as if it were set to true.
DefaultSiteRuleFilter
Based on the class atg.multisite.DefaultSiteContextRuleFilter, the component /atg/multisite/DefaultSiteRuleFilter is configured by a single property, defaultSiteId, which identifies the server’s default site ID. This filter executes after all filters that are specified in the ruleFilters property execute, and only if none of them returns a site ID.

