WebCenter Sites 12c provides a modular and upgrade-safe way for you to add customizations using Weblogic Server’s shared library mechanism. WebCenter Sites’ runtime application refers this shared library, and therefore, customizations that you add to this shared library become available at runtime and in the WebCenter Sites’ class path.
There are several benefits of using the shared library. When you upgrade WebCenter Sites, your customizations will remain intact, as they are externally managed in a separate shared library. Further, errors caused by customizations during deployment will be easier for you to debug.
Working with the Shared Library
WebCenter Sites runtime (
sites.war) refers a shared library called extend.sites.webapp-lib.war. Out-of-the-box, this shared library is a placeholder. You must add all WebCenter Sites customizations to
extend.sites.webapp-lib.war. Here are some examples of artifacts that you would share in the shared library:
You are building an application that needs files such as
<customapp>.js, an image (e.g.
<custom>.png), and a CSS file (e.g.
<custom>.css). You can add these files to
You are building a custom tag library that will be used for creating templates. This library includes
Here’s how you create the shared library with your customizations:
Assemble custom resources (
.jarfile) and package a shared library (
Deploy the shared library to the managed server where WebCenter Sites is running
Assemble Custom Resources and Package Your Shared Library
Assemble the resources (images, css, etc) in a base directory, with the relevant subdirectories. See Assembling Shared Java EE Library Files in Fusion Middleware Developing Applications for Oracle WebLogic Server for more information about building and deploying shared libraries to the WebLogic Server.
META-INF/MANIFEST.MFfile describing the library:
Manifest-Version: 1.0 Specification-Title: Customizations Specification-Version: 1.0 Implementation-Title: Custom Implementation Implementation-Version: 1.0 Implementation-Vendor: Example.com Extension-Name: images
Package the base directory as a WAR file. Here is what the packaging of the library looks like after you zip the library as a WAR file:
$ jar -tf customizations.war META-INF/ META-INF/MANIFEST.MF WEB-INF/weblogic.xml mylogo.gif WEB-INF/lib/custom.jar WEB-INF/futuretense_cs/custom.tld customapp.js custom.png
.jarfile is also placed in the
Note:The precedence of resource lookup is
sites.warfirst and then the shared library. WebLogic Server serves the resource it finds first. That is:
Looks for the resource in the
If it doesn’t find the resource in the
sites.warfile, it looks for it in the shared library.
Deploy Your Shared Library to the Managed Server Where WebCenter Sites is Running
Deploy the WAR as a library to the managed server where WebCenter Sites is running.
You can also deploy two JARs together via a single shared library that your web application will reference.