how do i chain up servlet filters?

From: Angus Parvis (angusparvis_at_hotmail.com)
Date: 07/29/04


Date: Thu, 29 Jul 2004 11:01:16 +0200

Hi,

I am developing a web-application using Tomcat 5. Most of the user's
requests invoke servlet filters before the request is passed to the
servlet itself.

What I want to do is to chain up several filters. For example when the
users requests /MyServlet the filter-chain should be like this:

LocalizationFilter -> AuthenticationFilter -> /MyServlet

There are more filters involved in this chain, but I don't want to make
the question too complicated.

Furthermore not every filter should be invoked at every request. There
are some servlets, that don't require authentication. These servlets are
located in a directory called /public, so every call to
/public/MyPublicServlet should invoke this chain:

LocalizationFilter -> /MyPublicServlet

I'm new to servlet filters and couldn't find any help in the
documentation of Tomcat or Java Servlets. If you know some good docs or
have some Tomcat-configs to solve this problem, please post them.

Thank you very much for your help.

Greetings,

Angus



Relevant Pages

  • controlling execution order of servlet filters
    ... requests invoke servlet filters before the request is passed to the ... What I want to do is to chain up several filters. ... be a way to control the invocation order of servlet filters. ...
    (comp.lang.java.programmer)
  • Re: Thread safety in Tomcat
    ... >> requests). ... > Tomcat to create a new instance of the servlet when the requests collide. ... SingleThreadModel doesn't magically make ... shared state into non-shared state. ...
    (comp.lang.java.programmer)
  • Re: high through put system
    ... We have a Servlet application that has to process 10K requests per ... You need to be more specific about what is not scaling up and how the throughput is measured. ... It makes no sense to look at CPU or memory utilization if your bottleneck is I/O. ...
    (comp.databases.oracle.server)
  • Re: how to send a stream to servlet doPost
    ... It's two different system, One is java application,other is ... use java send a stringto servlet, ... to servlet, servlet sending responses to java application), or are you ... If your case is option 1)java application sending requests to servlet, ...
    (comp.lang.java.programmer)
  • Re: Web Application Design Patterns
    ... all I'm trying to figure out a general design for a web application ... where a Servlet handles all the requests that have to do with either ... Some actions that can be performed to it depending on the context ... So for example the Servlet should be responsible for, ...
    (comp.lang.java.programmer)