Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-12 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gregor, On 3/9/2009 2:49 PM, Gregor Schneider wrote: > Don't have an example using ServletResponseWrapper here, but reading > this thread might shed some light: > > http://www.nabble.com/-Http-ServletResponseWrapper.getOutputStream()-td20452362.html

Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Ben Hu
Thanks a lot, Gregor. The example in that discussion does give me some ideas, but the requirements in that example is different. I need to change the content of original response either from JSP page or HTML page. I am trying to read servlet examples within Tomcat distribution. There is a CompressF

Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Gregor Schneider
Ben, On Mon, Mar 9, 2009 at 7:15 PM, Ben Hu wrote: > I am not sure whether or > not Tomcat has its own way to implement Servlet Spec. Tomcat implements the ServletSpecs as does any other Servlet-Container - there is not "Tomcat"-way. Don't have an example using ServletResponseWrapper here, but

Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Ben Hu
Thanks a lot for the example, Gregor. The filter I am working on needs to change the content of response, so I think I need to write customized ServletResponseWrapper and ServletOutputStream. And this is where I encountered the problem, the customized filter I wrote does not behavior as it says on

Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Gregor Schneider
PS.: forget about all the j_security-stuff - that was copy & paste from some other filter. Rgds Gegor -- just because your paranoid, doesn't mean they're not after you... gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2 gpgp-key available @ http://pgpkeys.pca.dfn.de:11371 -

Re: Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Gregor Schneider
To give you a start, a small real-world-example: package com.cr.manuals.filter; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import javax.servlet.FilterChain; import javax.servlet.FilterConfig; import javax.servlet.ServletException

Question about writing a servlet filter in Tomcat 5.5.x

2009-03-09 Thread Ben Hu
Hi, All, I am trying to write a servlet filter to change the response content on Tomcat 5.5.x. I am a newbie to servlet filter, so I searched online for couple examples to start. For example, I found this one: http://download.oracle.com/docs/cd/A97688_16/generic.903/a97680/filters.htm. This example