apache客户端http响应处理状态码http 100
我使用 apache httpdefault 客户端并执行 post 函数,如下所示,
HttpResponse imToken = httpClient.execute(httpPostIM);
获得的响应
HTTP/1.1 100 Continue
Connection: keep-alive
如下:
HTTP/1.1 200 OK
Date: Tue, 30 Aug 2011 19:11:35 GMT
我们如何从客户端处理这个问题?
I use apache httpdefault client and execute post function as below
HttpResponse imToken = httpClient.execute(httpPostIM);
the response obtained is
HTTP/1.1 100 Continue
Connection: keep-alive
followed by:
HTTP/1.1 200 OK
Date: Tue, 30 Aug 2011 19:11:35 GMT
How do we handle this from client side ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 来自 w3 的响应 100 的定义,这是 < a href="http://www.jmarshall.com/easy/http/#http1.1c4" rel="nofollow">响应内容就像。引用:
因此,如果您的客户端已经发送了整个请求,那么它应该等待服务器,直到它给出
200
或其他“最终”响应。根据 Apache
HttpClient
代码,您无需执行任何操作,因为客户端会忽略所有1XX
响应代码并继续寻找最终响应。这是来自HttpMethodBase
类中的commons-httpclient-3.1
:如果您没有看到此行为,那么也许您需要增加客户端超时?或许是等待的时间还不够长?
Here's the definition of response 100 from w3 and here's a good sample of what the response looks like. To quote:
So if your client has already sent the entire request then it should just wait the server out until it gives a
200
or other "final" response.According to the Apache
HttpClient
code, you don't have to do anything because the client ignores all1XX
response codes and continues to look for a final response. This is fromcommons-httpclient-3.1
in the classHttpMethodBase
:If you are not seeing this behaviour then maybe you need to increase your client timeout? Maybe it isn't waiting long enough?