Adding the UGC Web site extension to a JSP Web site

Install the User Generated Content Web site extension by adding a Java Web application to the live Web site.

Procedure

  1. Ensure that all the prerequisites for a Content Delivery Server Role are met on your target system.
  2. Create the following Web application directory structure:
    1. In the root folder, create a WEB-INF/ directory.
    2. In the WEB-INF/ directory, create subdirectories classes/ and lib/.
  3. Navigate to the Content Delivery\roles\ugc\java\ folder.
  4. Copy all the JAR files from the lib\ subfolder, and all the JAR files from the third-party-lib\ subfolder, to the WEB-INF/lib/ folder of your Web application.
  5. If you store published content in a database, download the JDBC driver (JAR file) required for your specific database vendor and copy it into the WEB-INF/lib directory of your Web application:
    VendorJDBC DriverRequired JAR
    Microsoft SQL ServerMicrosoft SQL Server JDBC Driver 4.0

    sqljdbc42.jar for Java 8

    sqljdbc4.jar for Java 6 or Java 7

    OracleOracle JDBC driver 11.2.0.3 (deprecated)

    ojdbc6.jar for Java 6 or Java 7

    OracleOracle JDBC driver 12.1.0.1

    ojdbc7-12.1.0.1.jar for Java 8

    ojdbc7.jar for Java 7

    ojdbc6.jar for Java 6

    IBM DB2IBM Data Server Driver for JDBC and SQLJ (9.7 GA) (deprecated)

    Not supported with Java 8

    db2jcc.jar for Java 6 or Java 7

    You can download JDBC drivers from the following locations:
  6. Navigate to \Content Delivery\resources\configurations\.
  7. Copy logback.xml from that folder to the WEB-INF/classes/ subdirectory of your Web application.
  8. Copy and rename the following configuration files to the WEB-INF/classes/ folder of your Web application:
    Corresponding configuration fileRenamed configuration file
    cd_ambient_conf_sample.xmlcd_ambient_conf.xml
    cd_dynamic_conf_sample.xmlcd_dynamic_conf.xml
    cd_storage_conf_sample.xmlcd_storage_conf.xml
    cd_link_conf_sample.xmlcd_link_conf.xml
    cd_ugc_conf_sample.xmlcd_ugc_conf.xml
    cd_wai_conf_sample.xmlcd_wai_conf.xml
  9. Open the file cd_dynamic_conf.xml for editing.
  10. In the <TCDLEngine> section, insert the following element just before the end tag:
    <TagBundle Resource="ugc_renderer_bundle.xml"/>
  11. Save and close cd_dynamic_conf.xml.
  12. Open cd_ambient_conf.xml for editing (if using).
  13. Find the <Security> section and enclose it in comments. This element is only needed if you intend to set up OAuth authentication.
  14. Save and close cd_ambient_conf.xml.
  15. Copy cd_licenses.xml, your Content Delivery license file available from SDL Tridion Customer Support, to the WEB-INF/classes directory of your Web application.
    If you want to name the file differently or put it in a different location, you need to update the License element in your configuration files.
  16. Optional: Configure logging.
  17. Configure the Storage Layer and optionally encrypt sensitive strings.
  18. Open cd_ugc_conf.xml in a plain-text or XML editor.
  19. Configure User Generated Content by editing the following elements:
    ODataEndPoint
    Set the URL attribute of this tag to the URL of the Content Delivery Web service that JSP tags must post submitted ratings and comments to.
    Security

    Set the attributes of this optional element, used for Web service authentication, as follows:

    AttributeValue
    EndpointSet to the URL of the Access Token Server.
    ClientIdSet to the client ID (user name) to authenticate.
    ClientSecretSet to the client secret (that is, password) to authenticate.

    You specified these parameters when you implemented authentication for the Content Delivery Web service.

  20. Save and close cd_ugc_conf.xml.
  21. From the installation media folder Content Delivery\resources\tld\, copy ugc.tld to the WEB-INF/lib/ subdirectory.
  22. Enable the Ambient Data Framework by adding the following to your web.xml:
    <filter>
    	<filter-name>Ambient Data Framework</filter-name>
    	<filter-class>com.tridion.ambientdata.web.AmbientDataServletFilter</filter-class>
    </filter>
    <filter-mapping>
    	<filter-name>Ambient Data Framework</filter-name>
    	<servlet-name>Content Delivery Web service</servlet-name>
    </filter-mapping>

    This enables the Ambient Data Framework for the Content Delivery Web service only. If you want to enable the Ambient Data Framework in the entire Web application, replace the servlet-name element with the following:

    <url-pattern>/*</url-pattern>
  23. If your Web application server is JBoss, do the following:
    1. Locate the following files in the WEB-INF/lib/ subdirectory and remove them:
      • stax-api.jar
      • serializer.jar
      • xalan.jar
    2. If you use JBoss 5.1 or 5.2, add the following JVM property-value pair to the JAVA_OPTS variable: -Dorg.jboss.logging.provider=slf4j
    3. If you use JBoss 6.0 or 6.1, create a file with the following contents called jboss-deployment-structure.xml and save the file in the WEB-INF/ directory:
      <jboss-deployment-structure>
      	<deployment>
      		<exclusions>
      			<module name="org.slf4j" />
      			<module name="org.slf4j.impl" />
      			<module name="com.sun.jersey" />
      			<module name="com.sun.jersey.json" />
      			<module name="com.sun.jersey.core" />   
      		</exclusions>
      	</deployment>
      </jboss-deployment-structure>
    4. If you use JBoss 6.0 or 6.1, open WEB-INF/web.xml, add the following section and save the file:
      <context-param>
      	<param-name>resteasy.scan</param-name>
      	<param-value>false</param-value>
      </context-param>
      <context-param>
      	<param-name>resteasy.scan.resources</param-name>
      	<param-value>false</param-value>
      </context-param>
      <context-param>
      	<param-name>resteasy.scan.providers</param-name>
      	<param-value>false</param-value>
      </context-param>
  24. If your Web application server is WebLogic, do the following:
    1. Remove the file stax-api.jar from your WEB-INF/lib/ subdirectory.
    2. Add a weblogic.xml file to the WEB-INF folder of your Web application that forces WebLogic to use the libraries contained in the Web application, rather than its own libraries. The contents of this weblogic.xml file must be as follows:
      <weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
      	xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
      	<container-descriptor>
      		<prefer-application-packages>
      			<package-name>javax.persistence.**</package-name>
      			<package-name>antlr.*</package-name>
      			<package-name>org.slf4j.**</package-name>
      			<package-name>org.apache.log4j.**</package-name>
      			<package-name>org.apache.xml.serializer.**</package-name>
      		</prefer-application-packages>
      	</container-descriptor>
      </weblogic-web-app>
  25. Restart the Web application.