问题描述
我正在使用Apache Commons HttpClient和Restlet来调用一个宁静的Web服务。不幸的是,我的服务器(基于Ruby on Rails)不喜欢HttpClient默认使用的 Transfer-Encoding:chunked
。
I am using the Apache Commons HttpClient along with Restlet to call a restful web service. Unfortunately, my server (based on Ruby on Rails) does not like the Transfer-Encoding: chunked
that HttpClient is using by default.
有没有办法禁止从客户端使用分块编码用于POST?
Is there any way to disable the usage of chunked encoding for POSTs from the client?
推荐答案
如上所述Restlet邮件列表,在Restlet 2.1版中,您可以将ClientResource#entityBuffering属性设置为true以缓存内存中的内容并防止分块编码。
As said in Restlet mailing list, in Restlet version 2.1, you can set ClientResource#entityBuffering property to true to cache content in memory and prevent chunked encoding.
这篇关于HttpClient:禁用分块编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!