|

楼主 |
发表于 2018-6-27 10:00:15
|
显示全部楼层
MAC版本直接重新解压了一个新的目录,在demo里的API.java里增加两行import,再进行模型编译就报以上错误,代码如下
package bmap;
import java.io.IOException;
import java.sql.SQLException;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import com.alibaba.fastjson.JSONObject;
import com.justep.baas.action.ActionContext;
import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException;
import com.sun.org.apache.xml.internal.security.utils.Base64;
public class Api {
public static JSONObject convertLocation(JSONObject params, ActionContext context) throws SQLException, NamingException, ClientProtocolException, IOException {
HttpServletResponse resp = (HttpServletResponse)(context.get(ActionContext.RESPONSE));
String longitude = params.getString("longitude");
String latitude = params.getString("latitude");
String url = "http://api.map.baidu.com/geoconv/v1/?coords="+longitude+ ","+ latitude +"&from=1&to=5&ak=xifH76TpyIL1cvnTzuEP0bpq";
HttpGet httpGet = new HttpGet(url);
CloseableHttpClient httpclient = HttpClients.createDefault();
CloseableHttpResponse response = httpclient.execute(httpGet);
String resultContent = new BasicResponseHandler().handleResponse(response);
resp.getWriter().write(resultContent);
return null;
}
} |
|