concept valve in category jboss

This is an excerpt from Manning's book JBoss in Action: Configuring the JBoss Application Server.
Table 5.3. The configurable elements in the server.xml file
Element
What is it?
When would you configure it?
Server
Represents the entire servlet container.
Likely never.
Service
Container for multiple connectors that share a single engine.
Likely never.
Connector
Binds to a particular port and listens for requests using a particular protocol.
For any changes to the protocol or port that clients use to communicate with the web container. We discuss this in section 5.4.
Engine
Receives and processes all requests from all connectors in the same service. The engine must be defined after all the connectors.
When you’re setting up load-balanced JBoss Web Server nodes as discussed in chapter 13.
Realm
Defines how security information (such as usernames, roles, and passwords) is handled.
If you need to change the strategy for mapping X509 certificate chains to a principal for authentication purposes. We discuss this when we talk about web security in chapter 6.
Host
Defines virtual hosts.
If you need to add or change the configuration for a domains or hostname mapped to your server. We discuss this in section 5.3.1.
Alias
Specifies an alias for Host element that surrounds it.
If you have multiple names for the same virtual host. We discuss this in section 5.3.1
Valve
Intercepts requests that come into the system and executes code before the request reaches the targeted web component.
In order to add some sort of monitoring or logging capability to the web container or a particular web application. We discuss this when we talk about valves in section 5.6.
Sometimes you want to perform certain actions every time a request comes into the server. For example, you may want to log information about the request, or you may want to check the originating IP address on a request and block it if it’s on a blacklist. You can program this logging or blacklisting functionality into your application code, but because it’s not specific to your business logic, you might, instead, accomplish it using a valve, or interceptor.
JBoss Web Server provides valves that can intercept requests as they come into the server. Figure 5.11 shows how requests coming from HTTP clients are intercepted by a valve, the valve logs information about the request to a log file, and then the request continues to the destined web applications.
You can configure valves for individual applications by defining them in the WEB-INF/context.xml file. You can also define them at the server level as a sub-element of an engine or a host in JBoss Web Server’s server.xml file, as we discussed in section 5.2.3. Only the CachedConnectionValve is enabled by default, but others are available, yet commented out, in the server.xml file.
Valves are configured using the Valve element. The element must have an attribute called className that points to a Java class with the valve code. For example, imagine the following valve defined in the server.xml file:







