Questions tagged [httpsurlconnection]

329 questions
0
votes
1 answer

How to store an "untrusted/selfsigned" certificate for future connections

Using HttpsUrlConnection on Android, if I connect to a server with an untrusted certificate, most likely a self signed one, I'll get an error. When something similar happens in a browser for instance, I get the option to accept that certificate…
A.Grandt
  • 2,242
  • 2
  • 20
  • 21
0
votes
1 answer

Difference between HostnameVerifier and DefaultHostnameVerifier

I am implementing a hostname verifier for my SSL client. I know that the Default Hostname Verifier of the HTTPS URL connection is static. My problem is that I do not want the hostname verification to be static because I have multiple threads in my…
agenthost
  • 748
  • 2
  • 9
  • 24
0
votes
1 answer

Android: use HttpsUrlConnection for upload and get response but got SocketTimeoutException

I have a server with SSL certificate. And I am using functions uploadFileHttps(...) to upload an image and get corresponding response with HttpsUrlConnection. For the upload part, it sent out the image data through output stream. However, server…
Season
  • 1,178
  • 2
  • 22
  • 42
0
votes
2 answers

Android: app runs successfully, but logcat has java.security.cert.CertPathValidatorException: Trust anchor for certification path not found

My Android app makes HTTPS request to remote web service successfully (response code: 200). However, in Android Studio's logcat window, log level Verbose has messages like the following screenshot (log level Error no message) Here are my code. Any…
BNK
  • 23,994
  • 8
  • 77
  • 87
0
votes
0 answers

java6 HttpsUrlConnection error:javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake

I write a demo to access a server with java HttpsUrlConnection. I implement the X509TrustManager interface with MyX509TrustManager to trust all certificates. It works fine with JDK7 and JDK8, but when use JDK6 and JDK5, error…
fcbflying
  • 693
  • 1
  • 7
  • 23
0
votes
1 answer

Https Connection using Authentication and sending POST request Query and getting output in JSON

I am writing a program which would connect to a Https url and will authenticate using username and password and the send a Post request Query and get output in Json. I have been stuck up in authentication part and sending Post request. Please help…
Arnav
  • 51
  • 10
0
votes
2 answers

Receiving encoded response to HttpsURLConnection GET request

I am working on an Android app which will connect to a webpage using the java class HttpsURLConnection and parse the HTML response using JSoup. The issue is that the HTML response from the website appears to be encoded. Any ideas on what I can do to…
TheFlanman91
  • 141
  • 1
  • 2
  • 11
0
votes
2 answers

Retrieving Json data using android studio

I'm very new to using web apis and am having trouble getting data in JSON format using Riot Games' API. Here's the code: public void readJSONFeed(String address) throws IOException { URL url = new URL(address); JSONObject jsonResponse =…
0
votes
0 answers

Android ProviderInstaller and custom caches

TL;DR - The classes I need to use to allow my server to remain secure prevent my client remaining secure - I can't find a happy balance. I am using HttpsUrlConnection on android devices which are not readily accessible to humans. They run for long…
Andy Newman
  • 1,178
  • 2
  • 8
  • 23
0
votes
1 answer

Why are my Java HttpsURLConnection calls not working and cookies being lost?

I had a frustrating situation where some java code I'd written to automate some actions on a web site stopped working after the site switched to https. I could no longer login properly. Instead I'd end up getting a 200 result with the login…
0
votes
1 answer

In a Java HttpsURLConnection POST, I can't read the response from the server

I'm trying to do an HTTPS POST using this sample code: http://www.mkyong.com/java/how-to-automate-login-a-website-java-example/ About half way down there is a commented line of code: // System.out.println(response.toString()); The reason it is…
overcast75
  • 95
  • 1
  • 5
0
votes
1 answer

How to make REST API call using a token?

I am newbie developer in Java. STEP 1 I have already done the the following: Logged in to REST API server (with login&password) Received a token in XML format which i parsed with SAX parser so now i am in a position of a token. Below is the sample…
mapa
  • 39
  • 10
0
votes
1 answer

Java POST multipart/form-data containing json and bz2 compressed file parts

So I am running into an issue where I need to POST a bzip2 file through a java app. I do not have an issue with doing multi-part posts or using regular files (See the third example located on http://zewaren.net/site/?q=node/123) However, the above…
JarODirt
  • 157
  • 11
0
votes
1 answer

android internally aggregates requests\keep connection open?

I'm building android communication library for my project. I have several servers which I'm contacting using REST API so for my implementation I was wondering if anyone knows, if I contact same URL but different URIS, meaning I have different REST…
codeScriber
  • 4,582
  • 7
  • 38
  • 62
0
votes
1 answer

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException while sending a request to the server

I am trying to connect to a server and sending a HTTPS based request to it using the following code: // create the URL with the target URL specified URL url = new URL(vTargetURL); // create a HTTP connection to the URL specified HttpsURLConnection…
Mayank
  • 1,099
  • 4
  • 17
  • 44