Documentation Center

Configuring and deploying the API (RESTful) role as a Java/JSP web application

Installing the API (RESTful) Role as a Java web application involves configuring the location of the Discovery Service in the Content Delivery Client configuration file. In this file, you can specify configuration strings as hardcoded values or as parameters. Additionally, it may require some web application server-specific configuration before deployment can start.

Procedure

  1. In the configuration directory of the role, open cd_client_conf.xml for editing.
  2. Ensure that the file contains a root-level element called ServiceConfig that looks as follows:
    <ServiceConfig
      ConnectionTimeout="TIMEOUT"
      CacheEnabled="CACHE_ENABLED"
      CacheExpirationDuration="CACHE_EXP"
      ServiceAvailabilityCheck="SERVICE_CHECK">
      <DiscoveryService ServiceUri="URI" />
      <TokenService ClientId="USERNAME" ClientSecret="PASSWORD" />
    </ServiceConfig>
    where the values you set are as follows:
    ValueDescription
    TIMEOUTThe amount of time in milliseconds after which a connection to the Discovery Endpoint times out. A good default value would be 10000 (that is, 10 seconds); however, you may need to increase this value if your site has a large sitemap.
    CACHE_ENABLEDA Boolean to set to true if you intend to cache information retrieved from the Discovery Endpoint. Set this to true unless you have a pressing reason to disable it.
    CACHE_EXPThe amount of time in seconds after which the cache expires. A good default value would be 600 (that is, 600 seconds or 10 minutes).
    SERVICE_CHECKA Boolean to set to true if the client should check if the service is available.
    URIThe URL of the Discovery Endpoint.
    USERNAME and PASSWORDValid Token Service credentials that grant the client access to the Discovery Endpoint. You can find valid credentials in the cd_ambient_conf.xml configuration file of the Discovery Service. USERNAME must be a user who assumes the cd role; by default, that user is called cduser. Note also that the value of ClientSecret must be set to an encrypted value.
  3. If your Java/JSP web application service is WebLogic, you must additionally perform the following steps:
    1. In the WEB-INF/ subdirectory of your web application, in web.xml, add an attribute-value pair metadata-complete="true" to the web-app element, and save the file.
    2. From your installation media, copy the file Content Delivery\resources\web\weblogic.xml to the WEB-INF/ subdirectory of your web application.
  4. Deploy the role as a web application by starting the web application. Refer to your Java/JSP web application server documentation to learn how.