Update custom themes and skins for hardcoded context root references in a cluster

If you have developed custom themes or skins that contain hardcoded references to the portal's context root, this can cause problems if the context root is changed. This is particularly an issue after migration because the context root is modified during migration, causing hardcoded references to break. Rather than modifying custom themes and skins manually each time you change the context root, you can update themes and skins to remove the hardcoded references and instead use dynamic references that work properly regardless of the context root.

Custom themes and skins that are present in the wps.ear file on the source server prior to migration are consolidated in the MigratedThemes.ear file on the target server after migration. By starting with MigratedThemes.ear and modifying the themes and skins, you can then deploy the new EAR and make the updated themes and skins available to the portal.

  1. Extract the MigratedThemes EAR from IBM WebSphere Application Server using the administrative console.

  2. Expand the EAR to a directory using the EARExpander command in the was_profile_root/bin directory.

  3. Update the custom themes and skins to remove any hardcoded references to the original context root.

      Theme and skin artifacts that could have a hardcoded path include links to JavaScript files, CSS files, or other JSP files.

      Include statements of other JSP files in the theme can use relative paths. Hardcoded example: <%@ include file="/wps/themes/html/ThemeName/head.jspf" %>

      Corrected example: <%@ include file="./head.jspf" %>

      Links to resources within the theme EAR can be calculated with the findInTheme tag. Hardcoded examples:

      • <link rel="styleSheet" href="/wps/themes/html/ThemeName/css/SomeStyles.css" type="text/css" />

      • <link rel="styleSheet" href="/wps/themes/html/css/SomeStyles.css" type="text/css" />

      Corrected example:

        <%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.0/portal-logic" prefix="portal-logic" %>

        <link rel="styleSheet" href='<portal-logic:urlFindInTheme file="css/SomeStyles.css" />' type="text/css" />

      Links to resources in other EAR files or in a theme with its own EAR file can use server-relative URLs. Hardcoded example: <script type="text/javascript" src="/wps/themes/html/ThemeName/js/ThemeJavascript.js"></script>

      Corrected example, after the theme is moved to its own EAR file: <script type="text/javascript" src="/ThemeEarContextRoot/themes/html/ThemeName/js/ThemeJavascript.js""></script>

  4. You can change the context root for the themes and skins application by modifying the application.xml file for the EAR.

      You can also update the display name for the application and WAR name associated with the web module. For example:

      <?xml version="1.0" encoding="UTF-8"?>
      <application id="Application_ID" version="1.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">	
          <display-name>MigratedThemes</display-name> 
            <module id="WebModule_1">
               <web>
                  <web-uri>MigratedThemes.war</web-uri>
                  <context-root>/wps</context-root>
               </web>
            </module>
            <security-role id="SecurityRole_1276111387778">
               <description>Everyone in the enterprise.</description>
               <role-name>Everyone Role</role-name>
            </security-role>
            <security-role id="SecurityRole_1276111387779">
               <description>All Authenticated users in the enterprise.</description>
               <role-name>All Role</role-name>
            </security-role>
            <security-role id="SecurityRole_1276111387780">
               <description>No users in the enterprise.</description>
               <role-name>No Role</role-name>
            </security-role>
      </application>

  5. After updating the application.xml file, repackage the EAR, and deploy the EAR in WAS using the administrative console.

    If you intend to reuse the original context root for the migrated portal, remove the MigratedThemes.ear application generated during migration.

  6. To make the updated themes and skins available on the new context root, update the portal configuration for any themes and skins referencing the old context root.

    1. Export the themes and skins using the XML configuration interface.

        For example, create an XML input file containing the following request and submit it using the xmlaccess command:

        <request
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd"
            type="export">
         
            <!-- sample for exporting skins and themes-->
            <portal action="locate">    
                <skin action="export" objectid="*"/>
        		<theme action="export" objectid="*"/>
            </portal>
        </request>

        Example command:

        [[Directory structure wp7|WP_PROFILE]]/PortalServer/bin/xmlaccess.sh -url http://localhost:10039/wps_migrated/config -in request_input_file.xml -out request_output_file.xml -user portal_admin_id -password portal_foo

        The output file generated from the xmlaccess command contains the themes and skins defined in the portal.

    2. Edit the output file and update any references to the original context root for themes and skins.

        The following examples assume that the pre-migrated context root is /wps and the new context root is /MyCompanyTheme.
        Update <skin> elements

        • Example with old context root:

            <skin action="update" active="true" context-root="/wps" default="true" domain="rel" objectid="ZK_CGAH47L00G1M302N5SU00Q30C2" resourceroot="IBM" type="default" uniquename="ibm.portal.skin.IBM">

        • Example with new context root:

            <skin action="update" active="true" context-root="/MyCompanyTheme" default="true" domain="rel" objectid="ZK_CGAH47L00G1M302N5SU00Q30C2" resourceroot="IBM" type="default" uniquename="ibm.portal.skin.IBM">


        Update <theme> elements

        • Example with old context root:

            <theme action="update" active="true" context-root="/wps" default="true" defaultskinref="ZK_CGAH47L00G1M302N5SU00Q30C2" domain="rel" objectid="ZJ_CGAH47L00G1M302N5SU00Q3010" resourceroot="Portal" uniquename="ibm.portal.theme.Portal">

        • Example with new context root:

            <theme action="update" active="true" context-root="/MyCompanyTheme" default="true" defaultskinref="ZK_CGAH47L00G1M302N5SU00Q30C2" domain="rel" objectid="ZJ_CGAH47L00G1M302N5SU00Q3010" resourceroot="Portal" uniquename="ibm.portal.theme.Portal">

    3. After you complete the updates to the output file, you can use the file to re-import changes to the portal with the xmlaccess command.

  7. After all hardcoded references to the old context root have been removed and the updated themes and skins have been made available in the portal, you can change the portal context root; see "Changing the portal URI" for information.


Parent

Migrate a V6.1.x clustered portal


Previous

Configure resource management for site management in a cluster


Related tasks


Change the portal URI


Work with the XML configuration interface

WAS: EARExpander command

 


+

Search Tips   |   Advanced Search