You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Cheng <ch...@gmail.com> on 2011/07/21 16:39:30 UTC

completely disable "chunking" on server side

In the doc, I can see that client has the option to enable/disable chunking.
Is it possible to disable chunking completely on the server side?

Re: completely disable "chunking" on server side

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday, July 21, 2011 10:39:30 PM Christopher Cheng wrote:
> In the doc, I can see that client has the option to enable/disable chunking.
> Is it possible to disable chunking completely on the server side?

>From a CXF standpoint, not really, no.   You app server or whatever MAY have 
settings for it.  You would need to check with them.

>From within a servlet (which is basically what CXF would be  from this 
standpoint, the only ways to do it would be:

1) Set the "Connection: Close" header on the response.   You should be able to 
fairly easily do that from a CXF interceptor,  but you may not WANT to as that 
would disable the keep-alives and may cause performance issues. 

2) Write a CXF interceptor that would replace the servlets OutputStream in the 
message with a buffer of some sort (ByteArrayOutputStream or our 
CachedOutputStream) at the beginning of the output chain and then at the end 
of the chain, use that to set the Content-Length header on the response and 
copy that data to the real output stream.  



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com