在HttpsURLConnection中使用HttpDelete时libcore.io.Streams.readAsciiLine(Streams.java:203)的EOFException

时间:2014-08-28 11:13:58

标签: android web-services rest httpclient inputstream

我面临的错误信息是

java.io.EOFException
at libcore.io.Streams.readAsciiLine(Streams.java:203)
at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
at libcore.net.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:177)
at libcore.net.http.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:271)
com.example.rest.MainActivity.excutePost(MainActivity.java:354)
at com.example.rest.MainActivity$1.run(MainActivity.java:86)
at java.lang.Thread.run(Thread.java:841)

我的代码是

URL url = new URL(url);
con = (HttpsURLConnection) url.openConnection();
con.setRequestProperty("Content-Language", "en-US,en;q=0.8");
con.setRequestProperty("userID", "user20@yahoo.com");
con.setRequestProperty("password", "xyz123");
con.setRequestMethod(HttpDelete.METHOD_NAME);
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "*/*");
con.addRequestProperty("Accept-Encoding", "gzip");
InputStream inputStream = con.getInputStream();
String convertInputStreamToString = convertInputStreamToString(inputStream);

我试过这些链接

0 个答案:

没有答案