tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier (tomcat) ...@ice-sa.com>
Subject Re: how to write a valve
Date Fri, 14 Oct 2016 07:24:55 GMT
On 13.10.2016 17: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?
>
> 2)      Can a valve add an attribute to the request prior to the servlet getting the
request?
>
> 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?
>

Hi.

I think the best thing here is to point you to Google. If you search for 
"HttpServletRequest immutable", you'll get a whole bunch of useful links.
There is also example code there.

The basic thing here, is that the HttpServletRequest object that you get originally, is 
*immutable* (can't be modified, for example to add a header or add additional parameters).
So you have to "wrap" it with a HttpServletRequestWrapper, and then override some of the 
standard methods in that wrapper.


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


Mime
View raw message