Thanks

And what do you recommend to me for forcing to return  a Content-Type ?
Some weird clients require it

If I cannot do it with a Filter , where can I do it ?

2014-02-27 12:41 GMT+01:00 Konstantin Kolinko <knst.koli...@gmail.com>:
> 2014-02-27 12:18 GMT+04:00 Jose María Zaragoza <demablo...@gmail.com>:
>> Hello:
>>
>> I'm using Tomcat 6.0.24 and I'm testing how to return Content-Length header
>> So I've defined a Filter and declared in web.xml of my web application
>>
>> If I do this:
>>
>> HttpServletResponse httpResponse = (HttpServletResponse) response;
>> chain.doFilter(request, response);
>> httpResponse.setHeader("Content-Length", "200");
>>
>> doesn't work ( it doesn't set the header and
>> Transfer-Encoding:chunked is returned )
>> )
>>
>> but
>>
>> HttpServletResponse httpResponse = (HttpServletResponse) response;
>> httpResponse.setHeader("Content-Length", "200");
>> chain.doFilter(request, response);
>>
>> does and it works OK
>>
>> Why ?
>> Does anyone use a filter to set Content-Length header ?
>> Must I declared in web.xml of Tomcat ?
>>
>>
>
> 1. Why are you using such an old build of 6.0.x?
> 2. You cannot set headers when any part of the response has already
> been sent to client. At that time headers have already been sent over
> the wire.
> See ServletResponse.isCommitted().
> 3. You should be careful with that header. If you set it to a wrong
> value you may break something.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

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

Reply via email to