没有源代码可用于类型:GWT编译错误
2022-09-02 12:03:43
我正在尝试在我的GWT应用程序中通过servlet发出获取请求。在编译代码时,我收到这些错误。
[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项目/控制台应用程序上使用它,则此代码工作正常。