Forgot one thing. See intermixed.
On 21 Oct 2002 at 12:40, Andreas Probst wrote:
> Hi,
>
> you could extend HttpServletResponseWrapper. You overwrite all
> methods which you are interested in, save the values and call
> the super method, so the underlying HttpServletResponse knows
> them. Additionally you write getter methods, which return the
> set values.
>
> Example:
>
> public class LocalHttpServletResponseWrapper
> extends HttpServletResponseWrapper
> {
private int status = -1; // senseless initial value
> public LocalHttpServletResponseWrapper(HttpServletResponse
> res)
> {
> super(res);
> }//constructor
>
> public void setStatus(int sc)
> {
> super.setStatus(sc);
> this.status = sc;
> }//setStatus
>
> public int getStatus()
> {
> return status;
> }//getStatus
>
> }//class
>
> In your filter you receive a ServletResponse. Cast it to
> HttpServletResponse. Instantiate your
> LocalHttpServletResponseWrapper. Pass this new object to the
> doFilter.
> Afterwards you can use your getter methods. The caller of your
> filter will have a normal ServletResponse.
>
> Example:
>
> public void doFilter(
> ServletRequest req,
> ServletResponse res,
> FilterChain chain)
> throws IOException, ServletException
> {
> HttpServletResponse hres = (HttpServletResponse) res;
> HttpServletRequest hreq = (HttpServletRequest) req;
>
> LocalHttpServletResponseWrapper lres
> = new LocalHttpServletResponseWrapper(hres);
>
> chain.doFilter(req, lres);
> ...
> int status = lres.getStatus();
> ...
> }
>
>
> Good luck.
>
> Andreas
>
>
> On 21 Oct 2002 at 10:31, [EMAIL PROTECTED] wrote:
>
> > Hi,
> > I want to write a filter for Tomcat 4.0.3 which should record all the
> > traffic.But I cannot find any way to question the values of the headers of
> > a response in my ResponseWrapper. Normal HttpServletResponse class doesn't
> > have any getter methods for headers. In the debugger I can see that there
> > is a org.apache.catalina.connector.HttpResponseFacade which implements (via
> > superclass) a org.apache.catalina.HttpResponse which has header getter
> > methods. But I cannot use that because these classes are invisible. Does
> > anybody know a way to provide a reading access to these headers?
> >
> > thank you
> >
> >
> >
> > --
> > To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> > For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
> >
>
>
>
> --
> To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>
>
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>