sgx
sgx

Reputation: 1317

Download Data Using HTTPClient

Had a question about using Apache HTTPClient. I need to pull data from a website and found this useful tutorial https://hc.apache.org/httpclient-3.x/tutorial.html

In the tutorial it says we will write a simple application that "downloads a page".

Where exactly does it "download" the page to? I am not seeing mention of a database being set up so or some cloud storage or whatnot so where does the information "go" exactly (or where is it being held once the data is pulled)? I'm somewhat new to Java so this is a bit conceptual

Upvotes: 1

Views: 78

Answers (1)

Thomas Kläger
Thomas Kläger

Reputation: 21435

The "download" goes to System.out:

  // Read the response body.
  byte[] responseBody = method.getResponseBody();

  // Deal with the response.
  // Use caution: ensure correct character encoding and is not binary data
  System.out.println(new String(responseBody));

Upvotes: 1

Related Questions