Show Table of Contents
4.4. Configure a Web Application to use a Valve
Valves that are not installed as global valves must be included with your application and configured in the
jboss-web.xml deployment descriptor.
Important
Valves that are installed a global valves are automatically applied to all deployed applications.
Prerequisites
- The valve must be created and included in your application's classpath. This can be done by either including it in the application's WAR file or any module that is added as a dependency. Examples of such modules include a static module installed on the server or a JAR file in the
lib/directory of an EAR archive if the WAR is deployed in an EAR. - The application must include a
jboss-web.xmldeployment descriptor.
Procedure 4.1. Configure an application for a local valve
Add Valve element
Add a valve element with the attributes of name and class-name to the application'sjboss-web.xmlfile. Name is a unique identifier for the valve and class-name is the name of the valve class.<valve name="VALVENAME" class-name="VALVECLASSNAME"> </valve>
Specific Parameters
If the valve has configurable parameters, add aparamchild element to the valve element for each parameter, specifying the name and value for each.<param name="PARAMNAME" value = "VALUE" />
When the application is deployed, the valve will be enabled for the application with the specified configuration.
Example 4.1. jboss-web.xml valve configuration
<valve name="clientlimiter" class-name="org.jboss.samplevalves.restrictedUserAgentsValve">
<param name="restricteduseragents" value = "^.*MS Web Services Client Protocol.*$" />
</valve>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.