+

Search Tips   |   Advanced Search

Add static content to the custom theme

Add static content for your custom theme created based on one of the ready-to-use themes.

  1. Export the content from the file store. See Export content from the file store.

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

  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.war that uses the context path /MyDynamicContent. If we created a WAR file instead, create an EAR file before we can proceed.

    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 exported in step 1 into the WAR file.

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

  6. Make whitelist and black lists

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

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

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

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

    Sample: Serve all files that are not part of the WEB-INF folder.

      <web-app>    
        ........
        <context-param>
        <description>A regular expression that defines which of the resources in the war file can   
                     be served by the portal war datasource.</description>
        <param-name>com.ibm.portal.whitelist</param-name>
        <param-value>.*</param-value>
        </context-param>       <context-param>
        <description>A regular expression that defines which of the resources in the war file cannot 
                     be served by the portal war datasource.</description>
        <param-name>com.ibm.portal.blacklist</param-name>
        <param-value>WEB-INF/.*</param-value>
        </context-param>    ....
      </web-app>


Parent Packaging themes for deployment

Related concepts:

Export content from the filestore