This code executes a GET request using the fluent builder for the org.apache.http.client.HttpClient
// create a new HttpClient
final HttpClient client = new DefaultHttpClient();
// execute a GET-request and get the response as a String
final String response =
Http.get("http://somesite.com")
.use(client) // use this HttpClient (required)
.charset("UTF-8") // set the encoding... (optional)
.followRedirects(true) // ...follow redirects (optional)
.asString(); // execute request
// see http://code.google.com/p/httpclient-fluent-builder/
// create a new HttpClient
final HttpClient client = new DefaultHttpClient();
// execute a GET-request and get the response as a String
final String response =
Http.get("http://somesite.com")
.use(client) // use this HttpClient (required)
.charset("UTF-8") // set the encoding... (optional)
.followRedirects(true) // ...follow redirects (optional)
.asString(); // execute request
// see http://code.google.com/p/httpclient-fluent-builder/
No comments:
Post a Comment