当前位置: 动力学知识库 > 问答 > 编程问答 >

Java based Http client to read response from non HTTP compliant server

问题描述:

I am trying to connect to legacy HTTP server and it seems to be NOT complaint to HTTP protocol, when providing response. As I cannot change the server so looking a way to get around. I have tried

  1. Apache client

    httpResponse = httpclient.execute(httpPost);

    throws ClientProtocolException and httpResponse is null

  2. HttpURLConnection

    BufferedReader reader = new BufferedReader(new InputStreamReader(httpConn.getInputStream(),"UTF8"));

    throws java.io.IOException: Invalid Http response

I am trying to avoid opening a plain socket connection. Any other ways to read non-compliant HTTP response from any java HTTP client?

分享给朋友:
您可能感兴趣的文章:
随机阅读: