Hi,
I assume that when you say "capture" you mean "handle" ? Or maybe wrap?
To only handle outgoing (response) data in a filter, do something like this:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws Blah {
chain.doFilter(request, response);
// Now do whatever you want with the response
// Remember though that the response is likely committed by now
}
To only wrap a response is even simpler:
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws Blah {
// Do whatever
chain.doFilter(request, new MyResponseWrapper(response));
// Do whatever
}
Yoav Shapira http://www.yoavshapira.com
>-----Original Message-----
>From: Pablo Carretero [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, November 09, 2004 3:06 AM
>To: [EMAIL PROTECTED]
>Subject: Filter tricks in tomcat
>
>Hi,
>
>
>
>I'm working with Tomcat 5 from 3 months ago. I understand the filter
>architecture, but I cannot capture the response filter for my JSP and
>servelt. Tomcat 5 is Servlet 2.4, so I thing it can filter either request
>or
>response.
>
>
>
>What I can do, is capture the entire request and its response, to have a
>good mechanism of statistics in my web application.
>
>
>
>So, can you help in order to know how can I catch the response in a
>filter??
>
>
>Thanks in advanced,
>
>
>
>
>
>And best regards.
>
>
>
>
>
>.pcs
>
>
>
>______________________________________
>Pablo Carretero S�nchez
>Cygnux
>
>Arquitecto de Software
>Pintor Vel�zquez n� 3 Esc Izq 7� B
>28932 - M�stoles (Madrid)
>Movil: +34 699929150
>[EMAIL PROTECTED]
><http://www.cygnux.com/egroupware/email/compose.php?folder=INBOX&sessionid=
>1
>2a0f5acc6fd5805a190a5b55a147155&kp3=7c4ad1ea016bfe58bf86addf2e6064d3&domain
>=
>cygnux.com&[EMAIL PROTECTED]>
>
>
This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged. This e-mail is intended only for the individual(s) to whom
it is addressed, and may not be saved, copied, printed, disclosed or used by
anyone else. If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]