使用 volley 的 HTTPS 请求

HTTPS request using volley(使用 volley 的 HTTPS 请求)
本文介绍了使用 volley 的 HTTPS 请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我任何示例如何使用 volley 库执行 POST 或 GET 请求以使用由知名 CA 颁发的证书来服务器吗?与标准 http 请求相比,我是否需要更改任何内容?

Could somebody show me any example how execute POST or GET request using volley library to server with certificate issued by a well known CA? Do I have to change anything compare to standard http request?

我阅读了本教程 - http://ogrelab.ikratko.com/using-android-volley-with-self-signed-certificate/ 但它是关于自签名 SSL 证书的.

I read this tutorial - http://ogrelab.ikratko.com/using-android-volley-with-self-signed-certificate/ but it's is about self-signed SSL certificate.

如果有任何帮助,我将不胜感激

I will be grateful for any help

推荐答案

我也四处寻找答案.对我来说,我发现它就像更改我的请求 URL 一样简单:

I looked around to find an answer for this also. For me, I found it was as easy as changing my request URL from:

http://www.myserver.com/whatever

https://www.myserver.com/whatever

这可能取决于您的服务器和 DNS 设置.例如,我重定向我的根域:

This may depend on your server and DNS settings. For instance, I redirect my root domain:

https://myserver.comhttps://www.myserver.com.这是 Heroku 的事情......

https://myserver.com to https://www.myserver.com. It's a Heroku thing...

当我尝试向根域发出请求时,我收到了来自服务器的 301 响应,因为它试图重定向到 www 子域.请记住您的 DNS 设置.希望这对某人有帮助!

When I tried to make requests to the root domain, I got 301 responses from the server as it tried to redirect to the www subdomain. Just keep in mind your DNS settings. Hope this helps someone!

这篇关于使用 volley 的 HTTPS 请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)