The MediaBanner
cartridge displays a banner image to the site customer and can be configured to link to a static page or specified navigation state within the Commerce Reference Store application. The Style by Zhanna Brand Landing Page
uses this cartridge to display a brand-specific banner image.
Note that Oracle Endeca Commerce also includes a MediaBanner
cartridge out of the box. The Commerce Reference Store version of the MediaBanner
cartridge uses the same response model and configuration classes as the Oracle Endeca Commerce cartridge but it uses a different template and handler, as described in the sections below.
Template
The XML template for the MediaBananer
cartridge, located in <ATG10dir>/CommerceReferenceStore/Store/Storefront/deploy/cartridge_templates/MainContent-MediaBanner.xml
, sets the cartridge’s content type to MainContent
and its ID to MediaBanner
. The XML template defines two editable properties:
imageURL
: A string property that contains the URL for the image. The URL can be either a full or relative URL, for example:http://www.oracle.com/path_to_image
or
/crsdocroot/path_to_image
link
: A reference to acom.endeca.infront.cartridge.model.LinkBuilder
object. TheMediaBanner
cartridge handler calls theLinkBuilder
object’screateAction()
method to create acom.endeca.infront.cartridge.model.Action
object. TheAction
object contains details for the link that is associated with the banner image, if one exists. For more details on theLinkBuilder
andAction
objects, see Content Item and Handler below.
Content Item and Handler
While it has a similar purpose, the MediaBanner
cartridge that is implemented for Commerce Reference Store behaves differently from the MediaBanner
cartridge that is included out of the box with Oracle Endeca Commerce. The Oracle Endeca Commerce MediaBanner
cartridge retrieves media items that have been uploaded to the MDEX Engine or the Endeca Configuration Repository. The Commerce Reference Store version of the cartridge requires that you manually specify a URL for the image in Experience Manager. Both cartridges use the same classes for the associated content item and configuration, com.endeca.infront.cartridge.MediaBanner
and com.endeca.infront.cartridge.MediaBannerConfig
, respectively. However, they have different cartridge handler classes. The Commerce Reference Store version of the handler class is described below.
The /atg/endeca/assembler/cartridge/handler/MediaBannerHandler
component, which is of class atg.projects.store.assembler.cartridge.handler.MediaBannerHandler
, is responsible for creating and populating the MediaBanner
object. The MediaBannerHandler
class is an extension of the com.endeca.infront.cartridge.NavigationCartridgeHandler
class with overridden wrapConfig()
and process()
methods.
The wrapConfig()
method wraps the content item created from the XML template into a MediaBannerConfig
object. The MediaBannerConfig
object has a link
property that contains the com.endeca.infront.cartridge.model.LinkBuilder
object (this is the same LinkBuilder
object that is referenced in the template). The LinkBuilder
object represents the settings specified for the link in Experience Manager. Commerce Reference Store uses Oracle Endeca Commerce’s LinkBuilderEditor
to render the appropriate link-related settings in Experience Manager and then those settings are stored in the LinkBuilder
object.

Note: The Config
classes for the Oracle Endeca Commerce navigation cartridges, such as MediaBannerConfig
, are an implementation-specific convention. They exist to simplify the initialize()
method of the associated cartridge handler by externalizing the steps for aggregating all of the necessary cartridge configuration from various sources. This includes default configuration, business user configuration in Experience Manager, and URL configuration specified by the application end user. Because the Commerce Reference Store version of the MediaBanner
cartridge is based on the Oracle Endeca Commerce version, it also uses the MediaBannerConfig
class (though all of the configuration comes solely from Experience Manager). The resulting MediaBannerConfig
object contains the full set of properties required by the MediaBannerHandler
. Note that the other Oracle ATG Web Commerce-specific cartridges do not use Config
classes as part of their implementation.
The process()
method creates a new MediaBanner
object and populates its link
property (the imageURL
property comes directly from the configuration in Experience Manager). To populate the link
property, the MediaBannerHandler
calls the createAction()
method on the LinkBuilder
object contained in the MediaBannerConfig
object. This method constructs a link to a navigation state or a static page and then returns it in an object of one of the following types, each of which is a sub-class of the com.endeca.infront.cartridge.model.Action
class:
com.endeca.infront.cartridge.model.NavigationAction
: Represents the selection a particular navigation state.com.endeca.infront.cartridge.model.RecordAction
: Represents the selection of a particular record or aggregate record.com.endeca.infront.cartridge.model.UrlAction
: Represents a link to a URL.
The MediaBannerHandler
component has several configurable properties. These properties reference components that the LinkBuilder
object requires in order to construct the link associated with the media banner image.
navigationStateBuilder
: Specifies theNavigationStateBuilder
component that theLinkBuilder
object uses to create the media banner link. Out of the box, it is set to/atg/endeca/assembler/cartridge/manager/NavigationStateBuilder
.contentSource
: Specifies theWorkbenchContentSource
component that theLinkBuilder
object uses to retrieve content for the Endeca application. Out of the box, it is set to/atg/endeca/assembler/cartridge/manager/WorkbenchContentSource
.actionPathProvider
: Specifies theActionPathProvider
component that theLinkBuilder
object uses to determine the site root path and content path for the media banner link. Out of the box, it is set to/atg/endeca/assembler/cartridge/manager/DefaultActionPathProvider
.
Note: See the ATG Endeca Integration Guide for more details on the WorkbenchContentSource
and DefaultActionPathProvider
components.
Finally, the MediaBanner
cartridge name does not match the name of its handler exactly, so it must be added to the NucleusAssemblerFactory.handlerMapping
property so that the Assembler can identify the proper handler for it. See Registering Cartridges with the NucleusAssemblerFactory for details.
JSP Renderer
The store.war/cartridges/MediaBanner/MediaBanner.jsp
page retrieves the imageURL
and link
properties from the response MediaBanner
content item and then renders the image. If the link
property has a value, the image is rendered as a link.
Because the link property can contain any one of three types of Action
objects, the MediaBanner.jsp
page invokes a helper component called /atg/endeca/store/droplet/ActionURLDroplet
, which is of class atg.projects.store.droplet.ActionURLDroplet
. This component takes the Action
object returned in the MediaBanner.link
property as an action
input parameter and returns an actionURL
string that represents the complete URL for the media banner image link. The form of the complete URL depends on the type of Action
object:
For a
NavigationAction
object, the complete URL is composed of the request’s context path followed by theNavigationAction
object’scontentPath
andnavigationState
properties.For a
RecordAction
object, the complete URL is composed of the request’s context path followed by theRecordAction
object’scontentPath
andrecordState
properties.For a
UrlAction
object, the form of the complete URL depends on whether or not a relative URL was defined for the link in Experience Manager. If a relative URL was defined, theActionURLDroplet
component returns a URL that is composed of the request’s context path followed by theUrlAction
object’surl
property. If a full URL was specified in Experience Manager, theActionURLDroplet
component returns theUrlAction
object’surl
property by itself.
The following code example shows the use of the ActionURLDroplet
in the renderer code:
<dsp:droplet name="ActionURLDroplet"> <dsp:param name="action" value="${contentItem.link}"/> <dsp:oparam name="output"> <dsp:getvalueof var="actionURL" param="actionURL"/> </dsp:oparam> </dsp:droplet>