On 14/10/2016 10:51, André Warnier (tomcat) wrote:
> On 14.10.2016 10:05, Mark Thomas wrote:
>> 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.
> 
> Apologies for barging in.  Does that mean that, at this point, the
> request is still "mutable" ? (at the servlet filter level, it isn't, as
> far as I know).

Mostly, yes since a Valve has direct access to the internals.

In a Filter you are limited to what you can do with HttpServletRequest.
It isn't completely immutable (setAttribute(), setCharacterEncoding(),
changeSessionId()) but you have a lot less scope for changing the request.

Mark


> 
>>
>>> 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-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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

Reply via email to