Then I would go through the configuration documentation to see how to configure a valve a the Engine, Host, or Context level. Then, if I were still interested in writing one, I would take a look a the source code to the pre-written valves that ship with Tomcat and are covered in this page.
If you tell us what you're trying to accomplish, someone might be able to offer another alternative.
I'm trying to upgrade from Tomcat 5.0 to Tomcat 5.5 which has been written in embedded mode.The Problem I'm facing is that my application uses an interface ValveContext which is missing from Tomcat 5.5. Any idea how can i get this functionality (provided by ValveContext) with Tomcat5.5.
The invokeNext(request,respone) method of ValveContext interface is used to invoke next valve in the pipeline.