tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Logging all data sent to client
Date Wed, 25 Jul 2007 20:26:37 GMT
Hash: SHA1


ben short wrote:
> I ripped and altered the code of the Compression Filter servlet
> example from tomcat 5.5.23.

Okay. I haven't seen that example; I was just commenting on your post.

> There is no LoggingServletWriter, if you look in the original
> getWriter method the ServletOutputStream is wrapped by a PrintWriter.

Right. I was suggesting that you use whatever super.getWriter gives you,
instead of avoiding the upstream code.

> So your proposed change of the getWriter method to the following would
> result in the ServletOutputStream not being used if the client of the
> LoggingHttpServletResponse called the getWriter method and thus no
> logging of the response.

Well... if you wrap both (separately) the ServletOutputStream and
Writer, then you will get your logging.

> So saying that the finishResponse method change is not valid also. As
> the writer flush method should be called if a writer was created,
> which in turn will call the stream it has wrapped flush method.

Flushing should occur regardless of whether the user used a stream or a
writer. But, it's not up to you to call flush()... it's up to the
servlet code to do that.

The code you posted (granted, as an adaptation of an example found
online) was less of a wrapper and more of a blocker. It replaced
functionality supplied in the superclass instead of filtering it. I
would have the same criticism of the example. Perhaps I'll post what I
believe to be a superior example and see if the documentation
powers-that-be agree.

- -chris

Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla -


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message