+

Search Tips   |   Advanced Search

Add static content to the custom theme


  1. Export the content from the file store.

  2. Export the file required by the custom theme to the following folders:

    • themes
    • skins
    • layout-templates
    • common-resources

  3. Save the files to the disk.

  4. Add a web module to the existing custom theme.

    For this example, an EAR file name MyEar was created for the existing custom theme. The EAR file contains a web module named MyDynamicContent.was that uses the context path /MyDynamicContent. If creating a WAR file instead, create an EAR file before proceeding.

    1. Open the existing project, or import the existing EAR file as a project in the tool used to create the custom theme.

    2. Add a WAR file to the existing EAR file.

      In this sample, the name is MyStaticContent.war and the context root is /MyStaticContent.

    3. The web.xml file for the new web module can be as simple as the following example:
      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
               http://java.sun.com/xml/ns/javaee/web-app_2_4.xsd"
               version="2.4">
          <display-name>StaticHTMLContent</display-name>
          </web-app>
      

      The structure of the resulting EAR file looks like the following sample:

      MyEar
          META-INF
              application.xml
          MyStaticContent.war
          MyDynamicContent.war
      

      The following code is a sample of the application.xml file:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE 
          application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 
          1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
      <application id="MyEar">
          <display-name>MyEar</display-name>
          <module id="MyStaticContent">
              <web>
                  <web-uri>MyStaticContent.war</web-uri>
                  <context-root>/MyStaticContent</context-root>
              </web>
          </module>
          <module id="MyDynamicContent">
              <web>
                  <web-uri>MyDynamicContent.war</web-uri>
                  <context-root>/MyDynamicContent</context-root>
              </web>
          </module>  
      </application>
      

  5. Add the exported static content to the web module.

    1. Copy the static content that you exported in step 1 into the WAR file.

      The structure of the WAR file looks like the following sample:

      MyStaticContent
        themes   skins
        layout-templates
        common-resources
        WEB-INF
        web.xml
      

  6. Make whitelist and black lists

    For security reasons, the data source does not serve content until a special context parameter is set that defines which files from the web module WebSphere Portal is able to serve.

    Define a whitelist using a regular expression that matches the file to make available. In addition, with a blacklist we remove certain entries from the set of file available in the whitelist. A blacklist is helpful to serve a folder but not a certain file withis that folder.

    The expressions are case-sensitive, for example WEB-INF is different from Web-Inf.

    The parameters are set in the web.xml file of the web module containing the static theme content.

    For example, to serve all files that are not part of the WEB-INF folder.

    <web-app> 
      ........
      <context-param>
          <description>Defines which resources in the war can be served by datasource.</description>
    
          <param-name>com.ibm.portal.whitelist</param-name>
          <param-value>.*</param-value>
      </context-param>    
    
      <context-param>
          <description>Defines which resources in the war cannot be served by datasource.</description>
          <param-name>com.ibm.portal.blacklist</param-name>
          <param-value>WEB-INF/.*</param-value>
          </context-param> 
      ....
    </web-app>
    

  7. Adapt the theme code.

    1. If you copied the folders of the existing dynamic content of the theme as described. The relative paths used in these examples are still matching. If you reordered files or deleted them, you must apply the changes to the file that now contain the code.

    2. Open the bootstrap.jspf file in your custom theme.

      The original location of the file is...

        themes/html/bootstrap.jspf

      Search for the following line of code:

        URI davURI = pocSvc.createURI("dav","fs-type1/common-resources/ibm/css/portal/ibmPortlets.css");

      ...and change it to:

        URI davURI = pocSvc.createURI("war","<context-root-static-war>/common-resources/ibm/css/portal/ibmPortlets.css");


Parent: Packaging themes for deployment
Related:
Export content from the filestore