aspose file tools*
The moose likes Servlets and the fly likes Logging servlet response headers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Logging servlet response headers" Watch "Logging servlet response headers" New topic
Author

Logging servlet response headers

Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Hi all,
Is there a way for a javax.servlet.Filter to obtain the set of HTTP headers that the response being handled is going to send out?
I know I can get the headers my filtered servlet's are explicitly setting by handing out a wrapper object instead of the actual HttpServletResponse, but I'm interested in getting access also to those HTTP headers set by the container (for example, the "Server" header).


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I know it's not what you asked, but whenever I've needed this I have done it using a simple forwarding/logging proxy. I can't recall the name of the one I last used, but there are plenty about.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by Frank Carver:
I know it's not what you asked, but whenever I've needed this I have done it using a simple forwarding/logging proxy. I can't recall the name of the one I last used, but there are plenty about.
Yeah. That's what we've tried to do (using a sniffer) but it's a lot of work to set up such a thing and the last time we asked the hosting provider to set up the sniffer for a test, the sniffer crashed under the traffic (they put it into a "less than optimal" place in the network) which made me think about this question (again).
Do you have any suggestions to look at? Our primary concern is robustness (it's a money-making application...)
 
 
subject: Logging servlet response headers