tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Servlet Filter Examples
Date Thu, 22 Dec 2011 21:54:23 GMT
Hash: SHA1


At the ApacheCon NA Tomcat meetup back in November, there was general
interest in seeing some example servlet Filters in the Tomcat examples
directory. I said I'd write some. It's time to put my money where my
mouth was.

I have the following filters already in my current project would could
be edited a bit and put into Tomcat's examples. Is there any interest
in the following:

1. BrokenLocaleFilter -- fixes Opera 9's non-spec-compliant
   Accept-Language locale formatting (O9 uses en_US instead of en-us)

2. EncodingFilter -- sets request's character encoding when the client
   does not specify one. I think this is already in Tomcat -- I'll check

3. CredentialFilter -- looks for a Printipal in the request and a
   missing User object in the HttpSession, and loads a User from
   (wherever) and puts it into the session. Essentially, this allows
   a webapp to do a "real" "login" after contained-manager
   authentication has done its job.

4. HttpResponseSplittingPreventionFilter -- prevents HTTP response
   headers from containing CR or LF characters (features response

I also have this one sitting around. I think I wrote it on a dare for
the tomcat-user list:

5. HttpConversationRecorderFilter -- this captures an entire HTTP
   request and response and dumps them to (somewhere -- currently
   stdout) after the request completes.
   Features wrapping the request and response objects.
   Features massive buffering (!)

I'd also be happy to try my hand at other filters the community thinks
would be generally useful as well as educational.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message