The /atg/endeca/assembler/cartridge/renderer/ContentItemToRendererPath component is responsible for locating the correct renderer for the ContentItem that has been return by the Assembler in response to a request. The ContentItemToRendererPath component is an instance of the class atg.endeca.assembler.cartridge.renderer.CartridgeRenderingPathMapperImpl, which implements the atg.endeca.assembler.cartridge.renderer.CartridgeRenderingMapper interface. The core method of the CartridgeRenderingMapper interface is:
public String getRendererPathForContentItem(ContentItem pItem);
The getRendererPathForContentItem() method returns the web-app relative path of the JSP file used to render the ContentItem.
Creating the Path
The ContentItemToRendererPath component provides some configurable properties that control how a ContentItem is mapped to a JSP path:
formatString: The string that defines the relative path of the JSP file. Defaults to/cartridges/{cartridgeType}/{cartridgeType}{selectorSuffix}.jsp.{cartridgeType}is replaced by the type of the currentContentItem, which is determined using thecartridgeTypePropertyNameproperty, described below.{selectorSuffix}is provided by theSelectorReplacementValueProducer, also described below.cartridgeTypePropertyName: The name of theContentItemproperty that contains thecartridgeType. Defaults tocartridgeType.contentItemToReplacementPropertyNames: A map that creates a relationship between a sourceContentItemattribute’s name and aformatStringproperty name. You can use this map to makeContentItemproperties available for use in theformatString.replacementValueProducers: An array ofReplacementValueProducers, described below, that makes additional values available for use in theformatString.
To create the path, getRendererPathForContentItem() creates a replacement map that gets populated with values calculated by other components or retrieved from other contexts. The replacement map values are then used to replace placeholders in the ContentItemToRendererPath.formatString property, resulting in a string that defines the relative path of the JSP file.
ReplacementValueProducer and SelectorReplacementValueProducer
The atg.endeca.assembler.cartridge.renderer.ReplacementValueProducer interface can be implemented by components that need to make new, perhaps dynamically-generated, values available for use in the replacement map and, by extension, the formatString. It contains one method that adds values to the replacement map.
/** Add any replacement values to pMap. Note that a given * instance may add a single value, multiple values, or none. * * @param pMap--The map to add parameters to. * @param pContentItem--The ContentItem (available for reference * and calculating replacement values based on the content item) * ContentItem should not be modified. * @param pRequest--The current request. May be null, if invoked * outside of a request. */ public void addReplacementValues(Map<String, String> pMap, ContentItem pContentItem, HttpServletRequest pRequest);
Out of the box, the Core Platform includes one replacement value producer, the /atg/endeca/assembler/cartridge/renderer/SelectorReplacementValueProducer. This component adds a selector and selectorSuffix to the replacement map, if needed. A selector represents the type of device being used to view the web page, for example, a mobile device. The selectorSuffix is a corresponding suffix—for example, “_mobile”—that gets added to the end of the JSP renderer path, so that the correct JSP is rendered for that type of device.
The SelectorReplacementValueProducer component is of class atg.endeca.assembler.cartridge.renderer and its primary configurable properties are:
browserTypeToSelectorName: A map where the key is the browser type and the value is the corresponding type of device (the “selector”). Out of the box, this property is configured to include the entryiOSMobile=mobile, which declares that when the browser type isiOSMobile, the value in the replacement map forselectorismobile. TheselectorSuffixalways has the same value as theselectorwith a preceding underscore, making theselectorSuffixin this case_mobile. If no matching browser type is found,selectorandselectorSuffixare not set.selectorKeyName: The name of the key to use when putting the selector value into the replacement map. Defaults toselector.selectorSuffixKeyName: The name of the key to use when putting the selector suffix value into the replacement map. Defaults toselectorSuffix.selectorOverrideParameterName: The name of a request query parameter that can be used to override the selector setting in the replacement map. Defaults tociSelector. This property allows you to force a selector value ofmobileby having aciSelectorquery parameter value ofmobile.

