Thanks to everyone in advance –
So I went ahead and implemented this code:
How can I read an HttpServletReponses output stream?
Which gives me the body of the response (html etc), but I am not getting any headers at all – is this possible to do with HttpServletResponseWrapper? I need to capture the entire request to all for header modification etc.
Thanks,
Sam
If you want to capture headers, your best approach is to override all addHeader() / setHeader() (Date, int and String) in your HttpServletResponseWrapper and store them in a HashMap or Properties instance (or MultiMap if you’re using Google Collections).
Then you can do whatever you want with them in your filter after response is processed. You’ll need to expose them somehow in your wrapper as well (e.g. write a getHeaders() method) because regular
HttpServletResponsedoes not.