Both Oracle WebLogic and Oracle GlassFish provide mechanisms to mix-in static content located outside a Web Application Archive (WAR). We can leverage these facilities to create a simple WAR that can be used on either WebLogic or GlassFish for serving static content. This provides an easier to use approach for serving Oracle Application Express static resources when using Oracle Application Express Listener, compared to zipping all the Application Express resources into a large WAR. An added benefit of this approach is that changes within the static resources folder are picked up immediately, no need to restart or update the WAR. Let’s get started, we’re going to create a small WAR that contains the necessary deployment descriptors. First create a folder to work in.
|
|
Now create the JEE WAR descriptor, named: web.xml
with the following contents:
|
|
Next create the WebLogic specific deployment descriptor, named: weblogic.xml
with the following contents:
|
|
Note the values of the context-root
and local-path
elements, adjust these values to match your requirements. Next create the GlassFish specific deployment descriptor, named: sun-web.xml
with the following contents:
|
|
Note the values of the context-root
element and the dir
field within the value
attribute of the property
element, adjust these values to match your requirements. Next create the WAR from these files:
|
|
Finally deploy the static.war
file to your WebLogic or GlassFish server. One point to note is when using the Administration UI in GlassFish to deploy the WAR, the context root field is auto-filled by the UI based on the name of the WAR. Clear the contents of this field to ensure the context-root
value specified in the sun-web.xml
is used.