tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Logging all data sent to client
Date Wed, 25 Jul 2007 20:26:37 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ben,

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

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGp7H99CaO5/Lv0PARAmMoAJ9YgQVQc9oYXY/8WPSKdVmy4RXcrgCgluj7
2ShArNw0TujAheDYN4IVUzw=
=J3px
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message