我收到错误"目标主机不能为空,或在参数中设置".
这是我的代码:
String url = "http://maps.google.com/maps/api/directions/json?origin=1600 Pennsylvania Avenue NW, Washington, DC 20500&destination=1029 Vermont Ave NW, Washington, DC 20005&sensor=false";
HttpClient httpclient = new DefaultHttpClient();
String goodURL = convertURL(url);//change weird characters for %etc
HttpPost httppost = new HttpPost(goodURL);
HttpResponse response = httpclient.execute(httppost);
Run Code Online (Sandbox Code Playgroud)
在第5行(上面的最后一行),我的程序抛出异常.这是确切的错误:
java.lang.IllegalArgumentException: Host name may not be null
Run Code Online (Sandbox Code Playgroud)
我在方法convertURL中编码我的字符串...
goodURL = http://maps.google.com/maps/api/directions/json?origin=3%20Cedar%20Ave%2c%20Highland%20Park%2c%20NJ%2008904&destination=604%20Bartholomew%20Road%2c%20Piscataway%2c%20New%20Jersey%2008854&sensor=false
有什么建议?谢谢!
我来自角世界。Angular 8 最近发布了一个差异加载功能。这意味着,根据您的浏览器,将提供不同的编译 Javascript 代码。因此,假设您使用的是 Internet Explorer 11,该应用程序将下载 ES5 javascript 文件,而如果您使用的是常绿/新浏览器(chrome、firefox 等),那么您提供的 Javascript 将是 ES6。
React 世界中有这样的事情吗?
android ×1
angular ×1
ecmascript-5 ×1
ecmascript-6 ×1
http-post ×1
httpresponse ×1
javascript ×1
reactjs ×1