当前位置:编程学习 > JAVA >>

弱弱地问一下,可以通过java应用程序直接使用google map api么?不通过浏览器

弱弱地问一下,请问可以通过java应用程序直接使用google map api么?不通过浏览器访问 --------------------编程问答-------------------- http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_java.html --------------------编程问答--------------------
引用 1 楼 jiangsheng 的回复:
http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_java.html



谢谢楼上的链接啊! 英语看得我头大啊,能稍微解释一下么?是如何不用通过浏览器就可以访问google web 服务的呢? --------------------编程问答-------------------- 可以 通过HttpClient 后台发起请求,给你段代码参考

/**
 *  @param requestURL 要请求的地址
 * @return
 * @throws Exception
 */
private static String getHtml(String requestURL) throws Exception{
URL url=new URL(requestURL);
  HttpClient client=new HttpClient();
  HttpHost host=new HttpHost("localhost");
  client.getHostConfiguration().setHost(host);
//   HttpClientParams params=new HttpClientParams();
  GetMethod method=new GetMethod(url.toString());
  client.executeMethod(method);
  //获取响应的html
  return method.getResponseBodyAsString();
}
--------------------编程问答--------------------
引用 2 楼 wzy19840102 的回复:
引用 1 楼 jiangsheng 的回复:

http://code.google.com/apis/maps/documentation/mapsdata/developers_guide_java.html



谢谢楼上的链接啊! 英语看得我头大啊,能稍微解释一下么?是如何不用通过浏览器就可以访问google web 服务的呢?

一楼给的地址右上角有语言选项,选中文简体就可以了
google都给封装好了,不需要HttpClient了
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,