tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: how to write a valve
Date Fri, 14 Oct 2016 08:05:58 GMT
On 13/10/2016 16:04, Campbell, Lance wrote:
> Tomcat 8.0.38
> 
> In my Eclipse development environment when particular servlet requests are made I want
to simulate going through Shibboleth prior to Tomcat handling the request.  I wanted to see
if this will work.
> 
> In Eclipse within each dynamic web application I would add a valve to the context.xml
file.
> 
> The valve would:
> 
> 1)      Check the URL request.
> 
> 2)      If the URL string matches a list then it will add particular name value pairs
to the request.
> 
> Example of a possible valve:
> 
> <Valve className="my.valves.ShibbolethSimulationValve" />
> 
> 
> 1)      Can a valve actually identify a particular URL path?

Yes. Valves have access to Tomcat's internal request and response objects.

> 2)      Can a valve add an attribute to the request prior to the servlet getting the
request?

Yes.

> 3)      If item #1 and #2 will work does anyone have some base code for a value that
would get me started down the correct path?

Have a look in the org.apache.catalina.valves package. SemaphoreValve
and CrawlerSessionManagerValve should give you an idea.

Note that you can also do all of the above with a Filter that isn't
Tomcat specific and would, therefore, be usable with other containers as
well.

Mark


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


Mime
View raw message