Package com.ibm.wsspi.wab.configure
Interface WABConfiguration
-
public interface WABConfiguration
AWABConfiguration
is used to configure a Web Application Bundle (WAB). In order to configure a WAB aWABConfiguration
is registered as an OSGi service. TheWABConfiguration
is a marker interface that has no methods. Configuration for a WAB is specified by theWABConfiguration
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:
AWeb-ContextPath: @myWABContextPath
WABConfiguration
service can then be registered using the "contextName" value ofmyWABContextPath
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:
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<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>
<AD>
element with the idcontextName
hasinternal
as the name and hasibm: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:
Notice that the prefix<usr_myWAB contextPath="/myWab/path"/>
usr_
is specified for the<usr_myWAB>
element. Theusr_
is necessary if the bundle with theWABConfiguration
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 Modifier and Type Field Description static java.lang.String
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.static java.lang.String
CONTEXT_PATH
The context path to use for WABs that have the matching context name.
-
-
-
Field Detail
-
CONTEXT_NAME
static final java.lang.String 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:
- Constant Field Values
-
CONTEXT_PATH
static final java.lang.String CONTEXT_PATH
The context path to use for WABs that have the matching context name.- See Also:
- Constant Field Values
-
-