Java BasicResponseHandler异常

时间:2015-06-30 20:30:18

标签: java httpresponse

我尝试使用API​​并获得响应409.文档说我必须阅读正文以构建解决方案。但是,当我运行时:

String responseString = new BasicResponseHandler().handleResponse(response);
  

org.apache.http.client.HttpResponseException:冲突       at org.apache.http.impl.client.AbstractResponseHandler.handleResponse(AbstractResponseHandler.java:69)       at org.apache.http.impl.client.BasicResponseHandler.handleResponse(BasicResponseHandler.java:65)       at commlayer.Uploader $ FileUploader.chunkRequest(Uploader.java:844)       at commlayer.Uploader $ FileUploader。(Uploader.java:786)       at commlayer.Uploader.startUpload(Uploader.java:530)       at commlayer.Uploader.main(Uploader.java:152)

如何提取内容以获取所需信息?

1 个答案:

答案 0 :(得分:0)

如果您期待字符串/ json响应,请尝试此操作。

HttpResponse response = httpClient.execute(new HttpGet(URL)); String responseString = new BasicResponseHandler().handleResponse(response); System.out.println(responseString);

但需要更多信息。