java apache客户端http响应以处理状态代码http 100
我使用ApacheHttpDefault客户端并执行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
我们如何从客户端处理此问题
# 1 楼答案
这是response 100 from w3的定义,这是what the response looks like的一个很好的例子。引述:
因此,如果您的客户端已经发送了整个请求,那么它应该等待服务器发出
200
或其他“最终”响应根据Apache
HttpClient
代码,您不必做任何事情,因为客户端忽略所有1XX
响应代码并继续寻找最终响应。这是来自类HttpMethodBase
中的commons-httpclient-3.1
:如果您没有看到这种行为,那么您可能需要增加客户端超时?也许等待的时间不够长