How to add Valve to Apache Tomcat

◇◆丶佛笑我妖孽 提交于 2019-12-23 09:56:04

问题


I wrote a Valve for Apache Tomcat by extending org.apache.catalina.valves.ValveBase class and implementing inovoke() method. Now I want to add it to my Tomcat for execution? Please show me the steps.


回答1:


Create a jar with your Valve class.

Drop this into the $TOMCAT_HOME/lib folder.

Modify the server.xml to add the valve under Engine or Host tag as shown below, depending on which level you want it to operate.

 <Engine name="Catalina" defaultHost="localhost">
 <Valve className="org.whatever.MyCustomValve" />


来源:https://stackoverflow.com/questions/10878385/how-to-add-valve-to-apache-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!