我想做一个HTTPS post方法,从我的Android应用程序发送一些数据到我的网站.
我HttpURLConnection
先使用它,我的HTTP URL工作正常.我的生产网站是使用HTTPS的,我希望使用相同的POST发送HttpsURLConnection
.有人可以帮我正确使用课程吗?
我在这个链接找到了一些来源:
KeyStore keyStore = ...;
TrustManagerFactory tmf = TrustManagerFactory.getInstance("X509");
tmf.init(keyStore);
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, tmf.getTrustManagers(), null);
URL url = new URL("https://www.example.com/");
HttpsURLConnection urlConnection = (HttpsURLConnection)
url.openConnection();
urlConnection.setSSLSocketFactory(context.getSocketFactory());
InputStream in = urlConnection.getInputStream();
Run Code Online (Sandbox Code Playgroud)
应该是什么价值 KeyStore keyStore = ...;
?
我尝试使用相同的方式发送数据 HttpURLConnection
,但我看到一些POST数据丢失或出错.
我试过这个问题的方法.我在下面粘贴我的代码
String urlParameters="dateTime=" + URLEncoder.encode(dateTime,"UTF-8")+
"&mobileNum="+URLEncoder.encode(mobileNum,"UTF-8");
URL url = new URL(myurl);
HttpsURLConnection conn;
conn=(HttpsURLConnection)url.openConnection();
// Create the SSL connection
SSLContext sc;
sc = SSLContext.getInstance("TLS");
sc.init(null, null, new …
Run Code Online (Sandbox Code Playgroud) 我已经Graphhopper
使用$ git clone
命令并使用此处提供的亚洲地图在Ubuntu Server中进行了安装。
我使用以下命令启动了服务器:
$ ./graphhopper.sh web asia_india.pbf
Run Code Online (Sandbox Code Playgroud)
然后在发送以下请求时出现错误:
http://serveraddresss:8989/route?calc_points=false&point=9.983242,76.390418&point=9.990618,76.421088
Run Code Online (Sandbox Code Playgroud)
我从服务器收到的答案是:
{“ info”:{“ errors”:[{“ message”:“找不到点1:9.9906,76.421”,“详细信息”:“ java.lang.IllegalArgumentException”}]}}}
显然,在功能getPaths()
的核心/ src目录/主/ JAVA / COM / graphhopper / GraphHopper.java,功能locationIndex.findClosest(point.lat, point.lon, edgeFilter);
没有得到任何附近的道路。
但是,如果我在Graphhopper网站上尝试相同的点,它将得到它的最近点和到它的距离。(您可以在此处看到此内容)。
我想知道为什么我的Graphhopper服务器设置会提供与graphhopper.com不同的结果。
是否需要更改任何配置才能进行实时Graphhopper设置?
还可以有人告诉我如何在启动时单独重建jar文件,
$ ./graphhopper.sh web asia_india.pbf
以便可以打印一些图像并尝试调试或改进系统吗?
该功能如何locationIndex.findClosest(point.lat, point.lon, edgeFilter);
工作?我实际上不是来自Java背景。