Hi people,

You are correct. My header got ignored and was attempting to add after
'commit'.

I moved it to beginning of filter and tried updating towards the end, but
after 'commit', I wont be able to able to set the header value :(

I'm using struts2 application. I want to add some latencies [say mysql, our
components and tomcat itself] to header, so that I can print this in Apache
logs. Then looking at single apache log file, I would then be able to see
what took time.
Is it possible to achieve this in any way?

"(unless you are sending less than 8k in the response)"
I dont think this is working. I tried a file where content length came out
to be 10599 and 72 [<8K], but my header didnt get proper value in both
cases.

Thanks
Anantha


On Mon, Aug 10, 2009 at 9:08 PM, Tim Funk <funk...@apache.org> wrote:

> If you are doing this:
>
> doFilter() {
>  chain.doFilter()
>  response.addHeader(...)
> }
>
> Expect failure to occur. (unless you are sending less than 8k in the
> response)
>
> -Tim
>
>
> 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.
>>
>> 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?
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to