Commerce Reference Store’s SEO implementation requires Endeca URL-writing components, which are implemented as Spring beans, to be accessible through Nucleus. To enable this, Commerce Reference Store uses the ATG platform’s Spring integration (described in the Platform Programming Guide). Essential configuration is supplied through three XML files in the store.war/WEB-INF/
directory:
web.xml
spring-context.xml
endeca-seo-url-config.xml
To make the Spring framework available within Commerce Reference Store, the org.springframework.web.context.ContextLoaderListener
class is declared in the store.war/WEB-INF/web.xml
file:
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
In addition, the web.xml
file specifies the location of the Spring application context file:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-context.xml</param-value>
</context-param>
The Spring application context file is used to define the beans for the root Web application context. This file defines the NucleusPublisher
bean, which enables the application to refer to Spring beans as Nucleus components:
<bean name="/NucleusPublisher" class="atg.nucleus.spring.NucleusPublisher"
scope="singleton">
<property name="nucleusPath">
<value>/atg/spring/FromSpring</value>
</property>
</bean>
The spring-context.xml
file also imports the endeca-seo-url-config.xml
file, which contains the definitions and configuration for the various beans Endeca uses to construct SEO-friendly URLs:
<import resource="endeca-seo-url-config.xml" />
These beans therefore are all available as Nucleus components in the /atg/spring/FromSpring/
Nucleus folder. For example, the Spring bean named brandFormatter
is accessible at the Nucleus address /atg/spring/FromSpring/brandFormatter
.
A key bean specified in the endeca-seo-url-config.xml
file is seoUrlFormatter
, which is responsible for formatting the Endeca URLs. To enable seoUrlFormatter
in Commerce Reference Store, the urlFormatter
property of the /atg/endeca/assembler/cartridge/manager/NavigationStateBuilder
component is configured like this:
urlFormatter=/atg/spring/FromSpring/seoUrlFormatter
Note that the endeca-seo-url-config.xml
file must also be copied into the Endeca Sitemap Generator URL configuration directory, so that the URLs generated by the sitemap generator match the actual page URLs. See the Configuring the Endeca Sitemap Generator section for information about setting up the Endeca Sitemap Generator to work with Commerce Reference Store. For detailed information about configuration files for the Endeca Sitemap Generator, see the Oracle Endeca Commerce Sitemap Generator Developer’s Guide.
Spring JAR Files
To enable support for the Spring framework, the Commerce Reference Store store.war/WEB_INF/lib
directory contains copies of the Spring library JAR files. In addition, this directory contains a copy of the ATG springtonucleus.jar
file, which includes classes that enable Nucleus to access Spring components.
Note that Oracle WebLogic Server includes copies of the Spring library JAR files that may conflict with the versions included in Commerce Reference Store. To avoid problems, the store.war/WEB_INF
directory includes a weblogic.xml
file that configures the application to use the JAR files in store.war/WEB_INF/lib
rather than the application server’s versions. This is done through the following tags:
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
The weblogic.xml
file applies only to Oracle WebLogic Server, and is ignored on other application servers.