Sivakumar
Sivakumar

Reputation: 890

JBoss - implementing a application specific valve

How can we configure a Valve for a particular web application in jboss AS 6?

Thanks,
Sivakumar.

Upvotes: 0

Views: 852

Answers (2)

Cristian Vat
Cristian Vat

Reputation: 1612

Valves are usually configured in the Tomcat server.xml or context.xml file.

You can configure a context.xml specifically for your web application by creating a META-INF/context.xml file inside your WAR. Note that for it to work, you must not have a <Context> element for your application in the global Tomcat context.xml.

Then in your META-INF/context.xml just configure your specific Valve(s) for your application:

<Context path="/mycontext">
    <Valve className="com.example.MyValve" />
</Context>

Useful reference: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Defining_a_context and http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Request_Filters

Upvotes: 1

Heiko Rupp
Heiko Rupp

Reputation: 30994

I am not sure if there is an easy way to create valves in an application specific way. For most purposes you can use a servlet filter that can easily go into a .war archive.

Upvotes: 2

Related Questions