注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 子域部署Exchange服务器详..
 帮助

关于Xfire客户端HTTP/1.1 100 Continue的解决


2008-07-10 15:20:08
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://guojie.blog.51cto.com/59049/86992
近,在工作中基于Xfire开发大量的WebService服务,但是始终遇到一个比较棘手的问题:

2008-6-23 10:43:44 org.apache.commons.httpclient.HttpMethodBase writeRequest
信息: 100 (continue) read timeout. Resume sending the request
2008-6-23 10:43:45 org.apache.commons.httpclient.HttpMethodBase readResponse
信息: Discarding unexpected response: HTTP/1.1 100 Continue
2008-6-23 10:43:45 org.apache.commons.httpclient.HttpMethodBase readResponse
信息: Discarding unexpected response: HTTP/1.1 100 Continue
2008-6-23 10:43:48 org.apache.commons.httpclient.HttpMethodBase writeRequest
信息: 100 (continue) read timeout. Resume sending the request
2008-6-23 10:43:48 org.apache.commons.httpclient.HttpMethodBase readResponse
信息: Discarding unexpected response: HTTP/1.1 100 Continue
2008-6-23 10:43:48 org.apache.commons.httpclient.HttpMethodBase readResponse
信息: Discarding unexpected response: HTTP/1.1 100 Continue


虽然,通过查看源代码看出这只是属于Info级别的警告。但是,频繁抛出这样的日志也还是让人不爽,通过也会影响效率。
曾以为是服务端的效率问题,可是很简单的服务情况下,没有大量并发的情况下,问题依然存在。也曾以为是网络的问题,就是部署
本地,自己调自己,还是会有这个问题。实际,上因为Xfire默认的机制下,会不断的去和服务端握手造成的。
调用下面的代码即可解决问题。

HttpClientParams params = new HttpClientParams();
// 避免'Expect: 100-continue' handshake

params.setParameter(HttpClientParams.USE_EXPECT_CONTINUE,Boolean.FALSE);
//设置ws连接超时时间
params.setParameter(HttpClientParams.CONNECTION_MANAGER_TIMEOUT, 100);
client.setProperty(CommonsHttpMessageSender.HTTP_CLIENT_PARAMS,params);

本文出自 “程序人生” 博客,请务必保留此出处http://guojie.blog.51cto.com/59049/86992





    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: