【问题标题】:Java - NoHttpResponseException when using apache fluent api to postJava - 使用 apache fluent api 发布时出现 NoHttpResponseException
【发布时间】:2015-06-02 13:08:14
【问题描述】:

我不断使用 Java 和 Apache fluent api 将数据发布到服务器。

Content content = Request.Post(URL)
    .bodyForm(param)
    .execute()
    .returnContent();

上述工作完美,但经过一些随机执行时间后,我得到 org.apache.http.NoHttpResponseException: failed to respond。收到此异常后如何处理以再次发布相同的参数。

编辑

好的,我必须处理响应,类似这样的事情,但仍然不知道如何做到这一点。

Content content = Request.Post(URL)
        .bodyForm(param)
        .execute().handleResponse(new ResponseHandler<Content>() {

            public Content handleResponse(HttpResponse arg0)
                    throws ClientProtocolException, IOException {
                // TODO Auto-generated method stub
                return null;
            }
        });

【问题讨论】:

    标签: java apache exception-handling fluent http-request


    【解决方案1】:

    我没有使用流畅的 API,而是使用了以下方法并克服了我自己的问题:- get NoHttpResponseException for load testing Apache HttpClient Interim Error: NoHttpResponseException

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-20
      • 2023-04-03
      • 1970-01-01
      • 2017-09-28
      • 1970-01-01
      相关资源
      最近更新 更多