-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Anantha,

On 8/10/2009 11:05 AM, Anantha Padmanabha wrote:
> 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.

Do you get an error, or is your header just ignored?

> 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.

Are you sure it's not because the response has already been committed?
That's the usual problem. Are you attempting to add your header before
or after the response body is generated?

> When there is no content-length in response [ex: status code 304], my custom
> header is coming out nicely.

Note that a 304 response usually does not have much in the way of a
response body, and so the response may not have been committed.

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

I think you need to set your header earlier in the request/response time
line.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqAOQkACgkQ9CaO5/Lv0PAZ9wCfeMHKM5VXlR/m3vnUXyWZMVdj
NpgAoI4Hp2X/uVbOZrelgYGIhKN5Q4Hd
=a8EV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to