Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- URL server = new URL("https://www.myurl.com/path/sample_file.xml.gz");
- HttpsURLConnection connection = (HttpsURLConnection)server.openConnection();
- connection.connect();
- if (connection.getResponseCode() == 302 && connection.getHeaderField("location") != null){
- URL server2 = new URL(connection.getHeaderField("location"));
- HttpURLConnection connection2 = (HttpURLConnection)server2.openConnection();
- connection2.connect();
- InputStream in = connection2.getInputStream();
- }
Add Comment
Please, Sign In to add comment