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:


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 , and tags, as these tags are not needed. Next add the tags that will enable the disabling of the content compression:



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 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.

Wednesday, June 1, 2011

Remote Debugging custom task flows in WebCenter Spaces

For those who do not know, Oracle WebCenter Spaces is a ready-to-use application that delivers dynamic business communities and pulls together the capabilities of all the WebCenter Services. Oracle WebCenter Services provides a comprehensive set of standards-based components that enrich existing portals and Web sites with the industry's most complete and open set of Enterprise 2.0 capabilities. These Social Computing Services include wikis, blogs, online awareness and communications, content collaboration and social networks. Oracle WebCenter Services works with all Oracle portal offerings, enabling organizations to enhance their existing enterprise portals and Web sites, and empowering users with Enterprise 2.0 services that work with their existing information systems.

WebCenter Spaces can be customized using browser-based tools and also using JDeveloper. For example, you may want to deploy additional shared libraries that include custom code or some additional task flows. Or, you might want to edit/create WebCenter Spaces resources, such as skins, page templates, and navigations, in JDeveloper. When developing the custom task flows in JDeveloper, there are many times that you will need to test/debug the code after the code has been deployed to a running instance of Spaces. In this post I will describe how to accomplish this process.

Configuring the Spaces Managed Server Instance

The first step towards enabling debugging is to be able to start the WebLogic managed server, which is hosted Spaces, in debug mode. One way of setting this up is to modify the startManagedWebLogic.sh (linux) that will start Spaces. This script is located in the /user_projects/domains//bin directory. However, since this script is used to start all of the WebCenter hosted services (UCM, Collaboration, .etc), this would mean that these instances would be started in debug mode as well. Yes, this would be OK, but unneccesary for what I want to do. So what I do is to make a copy of this script (name the file something like startDebugManagedWebLogic.sh) and then modify this version of the script.

In the new startDebugManagedWebLogic.sh file locate the section that declares the JAVA_OPTIONS.

Modify the startDebugManagedWeblogic.sh file and add the debug java options: -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n to the JAVA_OPTIONS. For example, in my file I added this option in front of the existing option already there:

JAVA_OPTIONS="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n -Dweblogic.security.SSL.trustedCAKeyStore="/home/oracle/Middleware/wlserver_10.3/server/lib/cacerts" ${JAVA_OPTIONS}"
export JAVA_OPTIONS

Once this is done you will be able to use this script to start Spaces in debug mode. To check to see if the option has been enabled you will see the reference to the debug mode: Listening for transport dt_socket at address: 4000 in the Spaces terminal window.

Configuring JDeveloper

The next step is to enable the remote debugging feature for your project in JDeveloper. To do this, go to your project's properties. Select the Run/Debug/Profile section, and click the Edit button for the "default" setting. This will bring up a dialog where you can check the Remote Debugging option.

After this step you can then proceed to set breakpoints in your source, and then "Attach" to the running debug WLS instance. To attach, simply right click on the project (in the JDeveloper application navigator) and from the context menu, select "Start Remote Debugging".

Here's a screen shot of a JDeveloper debug session, debugging the WebCenter Page Service native API code, which I had blogged about in a previous post.

As you can see, being able to debug you Spaces based code in a running Spaces instance can be invaluable for tracking down those nasty bugs, and is very easy to set up.

New Blog Site by my fellow ATEAMers

My fellow ATEAM colleagues and I have started a new blog site, Oracle Fusion Middleware E20, which cover topics related to OFM, ADF, and WebCenter. The URL is http://fusione2o.blogspot.com/.