我检查网络是否可用与否URLjava.io.IOException:服务器返回的HTTP响应代码:411 JAVA
URL url = new URL("http://www.google.co.in/");
final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
// set connect timeout.
conn.setConnectTimeout(1000000);
// set read timeout.
conn.setReadTimeout(1000000);
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type","text/xml");
conn.setDoOutput(true);
conn.connect();
Integer code = conn.getResponseCode();
final String contentType = conn.getContentType();
虽然运行此代码,我发现了异常
URLjava.io.IOException: Server returned HTTP response code: 411
什么可能是错误。
[Might help](http://www.checkupdown.com/status/E411.html) – 2012-01-04 06:28:31