Skip to content

Instantly share code, notes, and snippets.

View AyeshW's full-sized avatar

Ayesh Weerasinghe AyeshW

  • Sri Lanka
View GitHub Profile
@rponte
rponte / App.java
Last active December 23, 2022 08:52
Downloading file using Apache HttpClient (>= v4.2) with support to HTTP REDIRECT 301 and 302 when using HTTP method GET or POST
public class App {
public static void main(String[] args) throws MalformedURLException {
URL rightUrl = new URL("http://cursos.triadworks.com.br/assets/css/main.css");
URL redirectableUrl = new URL("http://www.triadworks.com.br/assets/css/main.css"); // redirected to cursos.triadworks.com.br
Downloader downloader = new Downloader();
System.out.println("Downloading file through right Url...");