You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andun Sameera <an...@gmail.com> on 2012/06/26 09:59:58 UTC

Can we engage a Valve specifically for a Tomcat Web App

I have some web apps hosted in Tomcat container, Can we engage a Valve
specifically for a webapp ?

Thanks
AndunSLG

Re: Can we engage a Valve specifically for a Tomcat Web App

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 6/26/12 6:10 AM, André Warnier wrote:
> André Warnier wrote:
>> Andun Sameera wrote:
>>> I have some web apps hosted in Tomcat container, Can we engage
>>> a Valve specifically for a webapp ?
>>> 
>> I've never done it, but according to the excellent on-line 
>> documentation, you can. 
>> http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Introduction
>>
>> 
("context" being equivalent to "webapp")
>> 
> 
> ..but while we are at it, in such a case it may be better to use a 
> Servlet Filter, rather than a Valve.  A Valve is specific to
> Tomcat, while a servlet filter is part of the Java Servlet
> Specification, meaning that it will work under any servlet
> container, not just Tomcat.

+1

If you are developing a component from scratch, definitely use a
Filter unless you *really* need access to Tomcat's underlying objects.

If you are using a pre-built Valve, some of the Tomcat Valves are
already available as Filters which you can configure in your webapp's
web.xml instead of context.xml, which may be more convenient for you.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/qE0EACgkQ9CaO5/Lv0PBEwwCcDpC7QI+oZjgF5GP02XgXdnGD
kt8Aniek5TU7OqrzEGV5pFsOV7xv/ryL
=7SDf
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Can we engage a Valve specifically for a Tomcat Web App

Posted by André Warnier <aw...@ice-sa.com>.
André Warnier wrote:
> Andun Sameera wrote:
>> I have some web apps hosted in Tomcat container, Can we engage a Valve
>> specifically for a webapp ?
>>
> I've never done it, but according to the excellent on-line 
> documentation, you can.
> http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Introduction
> ("context" being equivalent to "webapp")
> 

..but while we are at it, in such a case it may be better to use a Servlet Filter, rather 
than a Valve.  A Valve is specific to Tomcat, while a servlet filter is part of the Java 
Servlet Specification, meaning that it will work under any servlet container, not just Tomcat.




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Can we engage a Valve specifically for a Tomcat Web App

Posted by André Warnier <aw...@ice-sa.com>.
Andun Sameera wrote:
> I have some web apps hosted in Tomcat container, Can we engage a Valve
> specifically for a webapp ?
> 
I've never done it, but according to the excellent on-line documentation, you can.
http://tomcat.apache.org/tomcat-7.0-doc/config/valve.html#Introduction
("context" being equivalent to "webapp")


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org