You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alex O'Ree <al...@apache.org> on 2018/01/14 02:03:24 UTC

Valve to dump response messages?

After googling, I've found the request dumper valve, but I was wondering if
there was an equivalent for response content? I have been able to rig up a
http servlet filter that can capture and log response messages but i was
looking for a more universal way to accomplish this for all http
requests/responses to tomcat.

Re: Valve to dump response messages?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alex,

On 1/15/18 12:47 PM, Alex O'Ree wrote:
> On Mon, Jan 15, 2018 at 12:27 PM, Christopher Schultz < 
> chris@christopherschultz.net> wrote:
> 
> Alex,
> 
> On 1/13/18 9:03 PM, Alex O'Ree wrote:
>>> After googling, I've found the request dumper valve, but I was 
>>> wondering if there was an equivalent for response content? I
>>> have been able to rig up a http servlet filter that can capture
>>> and log response messages but i was looking for a more
>>> universal way to accomplish this for all http
>>> requests/responses to tomcat.
>> 
>> Have a look at this: 
>> http://markmail.org/message/fumpfuspt7a3nesz
> 
> Thanks Chris, I do have a similar solution using servlet filters, 
> however i was looking for a solution using a valve. I do not know 
> much about how valves work yet but i'm digging through the source 
> now...

A Valve is essentially a Filter except that it will run *before* all
application-defined Filters and it has access to the request/response
objects at a lower level than a Filter would.

Most of those lower-level interfaces also implement the e.g.
HttpServletRequest/HttpServletResponse interfaces, so much of the code
can be copied verbatim from my example.

Or you can use my code as a starting point to write a Valve that uses
those lower-level interfaces. There are no built-in wrappers for
Tomcat's Request and Response objects, though, so "wrapping" them just
requires more work. (I did propose wrapper classes for those, but was
discouraged from adding them to Tomcat proper. You can look in BZ for
some very old code that does that.)

What are you actually trying to accomplish, here? Perhaps neither a
Valve nor a Filter is the best solution.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc7QIdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFj4Cw/+Pa+7kG123Q5r3msd
vRhPZR0ZWMZhfmy0Nwvdt1GRNkNRfyUmfurHCcaIHU00Q4AJejdMUm77vIEutyPs
s0r0n6NucE7Aqh2oXgNNowkscs942YcD5A7XumY873GIVqVfxysYVKIWMR8pRwRZ
wCn0x2c9bEX/RfuflHbfQT/0VLRET2WYMj19gTWVXKOk/fINus3PPdBMeys/vq8n
MsWgf0ya2RTB3lTaSEAD7S7UegdAWccRvuxa8BHbO9iWOdqE3dacx5JVr9GHt1n/
Geoi6owZSBxqJF5wUlPVBPsFaB7muC/P9D6FnKbvG9wPV0XbkxuWL+9jE6HGTKt7
2hJTZaomJIZNGTrfFktt2lJkfz14CCtR8wT+CpCttGr1Hi+skSUuqoyODDTGsaRL
QPeYWooyFrdNYscbdrt2LYgtbYm7FpNdc4wpaRKsYMVJ62KPdvFafHI0KsMVWhG+
n6hQuoheIIUWkjidF8dir2bSloAknriVwON+yFk1ttqAFh1SW8AMjwVOc1BOr/hk
3GxMYT4RQgrx/bZKYVnPA6nPkE1+gnV7+KmKHzItZQXf3c2CrG6TMTK6cZjm9yuo
tcBu4syf0eb0dTTEKvZ+J0od8w05pk4AhsyLSXjZ7D/O1Ek0pVqirq/Cz+SOySY9
JHoeTIqmKvySus/8OuJGUrSgK2o=
=n7jQ
-----END PGP SIGNATURE-----

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


Re: Valve to dump response messages?

Posted by Alex O'Ree <al...@apache.org>.
Thanks Chris, I do have a similar solution using servlet filters, however i
was looking for a solution using a valve. I do not know much about how
valves work yet but i'm digging through the source now...

On Mon, Jan 15, 2018 at 12:27 PM, Christopher Schultz <
chris@christopherschultz.net> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Alex,
>
> On 1/13/18 9:03 PM, Alex O'Ree wrote:
> > After googling, I've found the request dumper valve, but I was
> > wondering if there was an equivalent for response content? I have
> > been able to rig up a http servlet filter that can capture and log
> > response messages but i was looking for a more universal way to
> > accomplish this for all http requests/responses to tomcat.
>
> Have a look at this:
> http://markmail.org/message/fumpfuspt7a3nesz
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc5JYdHGNocmlzQGNo
> cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhB4Q/+MCjRFDwweGXioqGt
> T3rdtnwfYIMrUgxNDV+8hPdp2BabliNIkmLL3DVCdKqPrRISkQlQRsDBp+FTwIp0
> 0bX6BgTxVGz4hMfRIAMzU4Kz4Mb6f8/Q4x9hXSi331jl+4aSC5LWLHzuT1MOsPU7
> m9oGodiRdr7jYs+JMKF9315hRsDF4oBvfFDEwT321np8+DdUYi5+uQfoROq+0Okp
> G/ZAQEsUURamZIrp3+bULJNFQhkEcIaLjywJasrGmYyxEmD8aX6s7F5b1StWuTrX
> i21sW+2Lv2Vf1iMNPRfg2N2qA4IZ6tGcZmDanYrOKYnd48G2tQn3rMW5x642uSII
> AlmOy6jaAScUnhN1qEhFbkZimHCzlI2bD3YixaLKS5pJssRvlPaIZuRcv0tTMKId
> mZxUaDVxF6b/v5FYI7zmdtmKIF7rzEwWr/Qr6DjFuAi09LiU6zzX3Hsdrq7w1Ivg
> oOU5pKJ8T14z+2t9wAeXBKyWXCto6ZBjtUhVZ7X+HxqcT0p71pcpjVK5DaIFzGI5
> vI6eWWt6G9SEBXOGOponnN/1iS/Bm9JyJ0dlxTPeqs2mnzjMzPdHD6suYzs+/LYH
> zqzvl696jS5wjKpOyVmE3Aypy+1SkRCP01NIndYC0KGmIcw73I8mAFXGb8dGWFKE
> RqPz0mTVoL5scWBCQlJ6+DTkX8Y=
> =I+5u
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Valve to dump response messages?

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alex,

On 1/13/18 9:03 PM, Alex O'Ree wrote:
> After googling, I've found the request dumper valve, but I was
> wondering if there was an equivalent for response content? I have
> been able to rig up a http servlet filter that can capture and log
> response messages but i was looking for a more universal way to
> accomplish this for all http requests/responses to tomcat.

Have a look at this:
http://markmail.org/message/fumpfuspt7a3nesz

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQJRBAEBCAA7FiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlpc5JYdHGNocmlzQGNo
cmlzdG9waGVyc2NodWx0ei5uZXQACgkQHPApP6U8pFhB4Q/+MCjRFDwweGXioqGt
T3rdtnwfYIMrUgxNDV+8hPdp2BabliNIkmLL3DVCdKqPrRISkQlQRsDBp+FTwIp0
0bX6BgTxVGz4hMfRIAMzU4Kz4Mb6f8/Q4x9hXSi331jl+4aSC5LWLHzuT1MOsPU7
m9oGodiRdr7jYs+JMKF9315hRsDF4oBvfFDEwT321np8+DdUYi5+uQfoROq+0Okp
G/ZAQEsUURamZIrp3+bULJNFQhkEcIaLjywJasrGmYyxEmD8aX6s7F5b1StWuTrX
i21sW+2Lv2Vf1iMNPRfg2N2qA4IZ6tGcZmDanYrOKYnd48G2tQn3rMW5x642uSII
AlmOy6jaAScUnhN1qEhFbkZimHCzlI2bD3YixaLKS5pJssRvlPaIZuRcv0tTMKId
mZxUaDVxF6b/v5FYI7zmdtmKIF7rzEwWr/Qr6DjFuAi09LiU6zzX3Hsdrq7w1Ivg
oOU5pKJ8T14z+2t9wAeXBKyWXCto6ZBjtUhVZ7X+HxqcT0p71pcpjVK5DaIFzGI5
vI6eWWt6G9SEBXOGOponnN/1iS/Bm9JyJ0dlxTPeqs2mnzjMzPdHD6suYzs+/LYH
zqzvl696jS5wjKpOyVmE3Aypy+1SkRCP01NIndYC0KGmIcw73I8mAFXGb8dGWFKE
RqPz0mTVoL5scWBCQlJ6+DTkX8Y=
=I+5u
-----END PGP SIGNATURE-----

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