简体   繁体   中英

Java Web Service - Android App HTTPS/SSL

I have a question regarding my Java Web Service and my Android App. I want to use https now and want to make sure, that I am on the right way:

Do I have to install a certificate on my server and just update the web.xml within my webservice? (Switch to confidential) In my android app I have to use the right Libs to access the Web service.

Is it so simple?

Thanks, Jan

You can use something like OkHttp to communicate with your service.

I'm guessing you are using a self-signed certificate so to use SSL you need to configure an SSLContext and add your server certificate to the trust store.

Then you initialize OkHttp using the SSLContext.

Just use Let's encrypt for the back-end. This will give you the mighty s in https and on android just rename your URLs from HTTP -> HTTPS. I've used this method with Android Volley to create a RESTful service and it just worked by correcting the protocol inside the URL.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM