tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anantha Padmanabha <anantha.padmana...@bankbazaar.com>
Subject Custom response header not working because of Content Length
Date Mon, 10 Aug 2009 15:05:42 GMT
I'm using tomcat 6.0.18. I added a filter that adds a custom response header
by doing setIntHeader/addIntHeader, but it didnt work.

I debugged,looked at source and figured out that the place where its not
working.
Before adding headers, there is a check like this:

public boolean isAppCommitted() {
        return (this.appCommitted || isCommitted() || isSuspended()
                || ((getContentLength() > 0)
                    && (getContentCount() >= getContentLength())));
    }

Since contentCount [output buffer] and contentLength [Content-Length
response header] are equal in my case, its not adding that header.
When there is no content-length in response [ex: status code 304], my custom
header is coming out nicely.

Is there a way to not use fixed content lengths or should I add calculate
and change content length while adding custom header?

Thanks
Anantha

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message