我必須檢查apache服務器的訪問權限。我寫了一個獨立的代碼來檢查apache服務器的訪問權限。如果我簡單地鍵入URL是accessable ...但聞一運行它通過它的代碼拋出異常..Apache url無法訪問
爲java.io.IOException異常:服務器返回的HTTP響應代碼:403網址:http://10.98.12.151:80/server-status?auto
什麼是403響應碼? hw我可以讓它從獨立代碼訪問...
這是我的代碼 connecturl =「http://」+ ip +「:」+ port +「/ server-status?auto」; 012URtargetURL = new URL(connecturl); HttpURLConnection httpURLConnection =(HttpURLConnection)targetURL.openConnection();
httpURLConnection.setUseCaches(false);
httpURLConnection.setAllowUserInteraction(false);
httpURLConnection.setDoInput(true);
httpURLConnection.setRequestMethod("GET");
httpURLConnection.connect();
http://en.wikipedia.org/wiki/HTTP_403 你錯過了文件的擴展名嗎? – Chumillas 2011-05-30 10:34:28