tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pike <>
Subject a snooping servlet
Date Sat, 06 Sep 2003 13:15:01 GMT

I'm trying to write a servlet extension that logs the complete
request and response _body_ of any transaction.

these bodies are streaming, so to log them I need to
open the stream, read and log it, and reset it before
I let the servlet continue. I can do this in a Filter object
(i think?).

that is very ugly though.  the _good_ way to do it is probably:
create a filter that replaces request and response
objects by request and response wrappers. these
wrappers use extensions to inputstream and
outputstream that dont just read() and write(), but
also log() along the way.

but that is very ugly again ! I need to write 6 classes
and implement a whole bundle of interfaces to get
that job done.

does anyone have a simpler idea ?

Signature #1

View raw message