File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes about Valve in the context file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "about Valve in the context file" Watch "about Valve in the context file" New topic

about Valve in the context file

david hu
Ranch Hand

Joined: Jul 20, 2001
Posts: 143
I am thinking to use Valve element inside the context file of admin application of tomcat, i.e., admin.xml to filter traffic, i.e., only boxes from inside the company can access this admin application.

Inside the admin.xml file which is under the conf/Catalina/localhost, I am trying to put Valve element to filter machine that makes the request to the admin application, I only allows request from inside my company to access this application.

But my question is that how to specify this in the valve element. I read the doc of tomcat, it only specifies the IP address or host names in the valve element. Since the IP address and host names inside my company can be vastly differnt,I cannot think a good way to use regular expression to achieve that.

Any better ideas?
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Originally posted by david hu:

Any better ideas?

Yes, valves are Tomcat specific.
The concept was created before the servlet spec introduced filters.
The two are conceptually the same.

It makes more sense for app developers to write spec compliant (and thus portable) filters instead of container specific valves.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: about Valve in the context file
jQuery in Action, 3rd edition