HttpGetSpring
Do an HTTP GET from a URL using Spring Framework RestTemplate.
See REST in Spring 3: RestTemplate for tutorial and examples.
Spring uses the HttpClient from Apache HttpComponents for the HTTP requests.
Build
Build with Maven.
mvn clean install
Produces an executable .jar file
/target/HttpGetSpring.jar
Run
java -jar HttpGetSpring.jar
Options
usage: java -jar httpGetTest.jar url [-h] [-o <filename>] [-v]
Do an HTTP GET from a URL
-h,--help Show this help
-o,--output <filename> output file
-v,--verbose show HTTP headers and processing messages
Examples:
java -jar httpGetTest.jar https://someurl.com/get/stuff
java -jar httpGetTest.jar -o myfile.txt https://someurl.com/get/stuff