我想通過我的GWT應用程序中的servlet獲取請求。在編譯代碼時,我收到了這些錯誤。沒有源代碼可用於輸入:GWT編譯錯誤
[ERROR] Line 16: No source code is available for type org.apache.http.client.ClientProtocolException; did you forget to inherit a required module?
[ERROR] Line 16: No source code is available for type org.apache.http.ParseException; did you forget to inherit a required module?
[ERROR] Line 16: No source code is available for type org.json.simple.parser.ParseException; did you forget to inherit a required module?
我該怎麼做才能消除這些錯誤? GWT不支持這些類嗎?
以下是我使用
public String getJSON() throws ClientProtocolException, IOException, ParseException{
HttpClient httpclient = new DefaultHttpClient();
JSONParser parser = new JSONParser();
String url = "some - url - can't disclose";
HttpResponse response = httpclient.execute(new HttpGet(url));
JSONObject json_data = (JSONObject)parser.parse(EntityUtils.toString(response.getEntity()));
JSONArray results = (JSONArray)json_data.get("result");
}
此代碼工作正常的代碼,如果我用這個在通常的Java項目/控制檯應用程序。