Package com.ibm.wsspi.wab.configure
Interface WABConfiguration
public interface WABConfiguration
A
WABConfiguration
is used to configure a Web Application Bundle (WAB).
In order to configure a WAB a WABConfiguration
is registered as an OSGi
service. The WABConfiguration
is a marker interface that has no methods. Configuration
for a WAB is specified by the WABConfiguration
OSGi service registration using the service
properties "contextName" and "contextPath".
A WAB specifies the context path using the OSGi bundle manifest header Web-ContextPath. To specify
that a WAB has a configurable context path the Web-ContextPath header value must begin with
the @
character and the remaining content after the initial @
character
are used as the "contextName". For example:
Web-ContextPath: @myWABContextPath
A WABConfiguration
service can then be registered using the "contextName" value
of myWABContextPath
to configure the context path. For example, the following declarative
service component can be used:
@Component( configurationPid = "my.wab.configuration", configurationPolicy = ConfigurationPolicy.REQUIRE) public class MyWABConfiguration implements WABConfiguration { // Only used to set "contextPath" and "contextName" service // properties from configuration admin using the pid // my.wab.configuration }The meta-type XML to specify the configuration of this component is the following:
<metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.1.0"
xmlns:ibm="http://www.ibm.com/xmlns/appservers/osgi/metatype/v1.0.0"
localization="OSGI-INF/l10n/metatype">
<OCD description="My WAB Configuration" name="My WAB Configuration"
id="my.wab.configuration" ibm:alias="myWAB">
<AD name="Context Path" description="The Context Path"
id="contextPath" required="true" type="String" default="/default/path" />
<AD name="internal" description="internal"
id="contextName" ibm:final="true" type="String" default="myWABContextPath" />
</OCD>
<Designate pid="my.wab.configuration">
<Object ocdref="my.wab.configuration"/>
</Designate>
</metatype:MetaData>
This metatype specifies the default values for both "contextName" and "contextPath".
If the user specifies no additional configuration then the default values will be used to
configure the WAB context path. Notice that the <AD>
element with the id contextName
has internal
as the name and has ibm:final
. This allows the
default to be specified for the service
component but does not allow a user to override the default in the server.xml configuration.
The WAB context path can then be configured using the following server.xml configuration element:
<usr_myWAB contextPath="/myWab/path"/>
Notice that the prefix usr_
is specified for the <usr_myWAB>
element. The usr_
is necessary if the bundle with the WABConfiguration
component is
installed as a
usr feature. If the bundle is installed with a product extension then the prefix would be the product name
followed by the _
character.-
Field Summary
Fields
-
Field Details
-
CONTEXT_NAME
If a WAB has a Web-ContextPath value that begins with @ then the remaining content after the initial @ character are used as the context name. The WAB installer looks forWABConfiguration
services that have a matching context name property.- See Also:
-
CONTEXT_PATH
The context path to use for WABs that have the matching context name.- See Also:
-