java: apache HttpClient > how to disable retry

前端 未结 5 2170
再見小時候
再見小時候 2021-02-01 16:41

I\'m using Apache Httpclient for Ajax-calls on a website. In some cases requests to external webservice fail, often with:

I/O exception (java.net.ConnectException) caug

5条回答
  •  忘掉有多难
    2021-02-01 17:04

    There's a description in the HttpClient tutorial.

     client.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, 
               new DefaultHttpMethodRetryHandler());
    

    See the tutorial for more information, for instance this may be harmful if the request has side effects (i.e. is not idempotent).

提交回复
热议问题