2014-02-27 18:31 GMT+04:00 Jose María Zaragoza <[email protected]>:
>
> 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 ?
>

You can do it in a Filter.

As I said,
1. The header must be set before writing anything to the output
stream. That is per HTTP/1.1 protocol.
2. The header must have correct value.

How to implement that is up to you (do not expect me to teach you java
programming, but maybe others here will do).

If you do not know the length before response is generated, a solution
can be to buffer the response before writing it out.

Buffering can be done by writing an adapter around servlet response
that replaces default output stream with a buffered one. The adapter
can be implemented by extending
javax.servlet.http.HttpServletResponseWrapper class.  Some caching
frameworks have filters that perform such buffering and caching.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to