Wednesday, June 22, 2011

Disabling Content Compression in WebCenter Spaces

By default, and for performance/optimization, WebCenter Spaces runs in the browser with the page markup generation compression set to be ON. 


However, there are cases when you are developing a customized skin (CSS) for Spaces, that you need to "see" the actual component's style class selector name (af_panelGroupLayout), not the compressed version (i.e. xyz).  To disable the compression is an easy step.  Bascially, you will need to add a context-param to Spaces web.xml:

<context-param>
  <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
  <param-value>true</param-value>
</context-param>

What's not so intuative is how this is achieved in Spaces.  The best way to do this is through the extension workspace, DesignWebCenterSpaces.jws.  You can get more information on "extending" Space, and also the download link to the workspace here.  Once you have downloaded (and configured) the DesignWebCenterSpaces workspace, you can then follow the next steps.

Double-click the WebCenterSpacesExtensionLibrary project inside the workspace.  This will open the Project Properties dialog. In the left pane, select the Project Source Paths.  In the "Included" tab section, click on the "Add..." button.  From within the "Add Include Filters"dialog, navigate to and select the web.xml file from within the WebCenterSpacesExtensionLibrary/public_html/WEB-INF directory. 


Click OK to dismiss the dialog.  This will add the web.xml to the project.


Next, in the left pane, click on "Deployment".  In the right pane, select the custom_webcenter_spaces_war (WAR File) deployment profile, and click the "Edit..." button.  This will open the Edit WAR Deployment Profile Properties dialog.  In the left pane, open the "File Groups", "Web Files" section, and select "Filters".  In the right pane, check the web.xml file.


Click OK, to save and dismiss the dialog. Next click OK to save and dismiss the Project Properties dialog.  In the Application Navigator, expand the WebCenterSpacesExtensionLibrary\public_html\WEB-INF folder.  Notice that the web.xml has been added.  Double-click on this file to open it in the file editor.  Remove the <filter>, and <filter-mapping> tags, as these tags are not needed.  Next add the tags that will enable the disabling of the content compression:

<context-param>
  <param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
  <param-value>true</param-value>
</context-param>

Save the file.  The next step is to regenerate the WAR file for deployment.  (Note: by default (OOTB), there is already a version of this war, which has been deployed to the Spaces server.  The deployment process will created a "versioned" war.  More on this later ...)  Locate the build.xml file, which is located within the WebCenterExtensionLibrary project.  Right-click on the build.xml, and from the context menu, select "clean stage" from the Run ANT target menu options.


This will create the new "extend.spaces.webapp.war" file, which will update the already deployed version in Spaces.  Before deployment, you can check to see if the web.xml has been added to the war by looking into the "exploded" directory. For example:


You will see a <servlet> tag has been added along with the content compression based tag, but this is OK.  Once you have confirmed that the web.xml has been added.  You are ready to deploy the new war to the WebLogic managed instance. Locate the build.xml file again.  Next right-click on the file, and from the context menu, select "deploy-shared-lib" from the Run ANT target menu options.


The ANT task will run and deploy the new version of this war.  After a successfull execution, you can view the new deployment in the WebLogic console.  The newest version, signified by the highest version number, will be the library that gets used by WebLogic.


After the deployment has been verified, you will need to RESTART the Spaces managed instance.  Once this is done, open up Spaces and for example, in Firebug you will notice that the style classes are displaying the real names. 


 As you can see, this option can really help speed up the development of a CSS, and ensure that you are using the right style class.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.