I can\'t understand why Java\'s HttpURLConnection
does not follow an HTTP redirect from an HTTP to an HTTPS URL. I use the following code to get the page at htt
Another option can be to use Apache HttpComponents Client:
org.apache.httpcomponents
httpclient
Sample code:
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet("https://media-hearth.cursecdn.com/avatars/330/498/212.png");
CloseableHttpResponse response = httpclient.execute(httpget);
final HttpEntity entity = response.getEntity();
final InputStream is = entity.getContent();