我檢查網絡是否可用與否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