Created
January 7, 2011 21:57
-
-
Save jfarcand/770187 to your computer and use it in GitHub Desktop.
AsyncHttpClient Simplified API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SimpleAsyncHttpClient class API: | |
public Future<Response> post(BodyGenerator bodyGenerator) throws IOException ; | |
public Future<Response> post(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException ; | |
public Future<Response> put(BodyGenerator bodyGenerator, BodyConsumer bodyConsumer) throws IOException ; | |
public Future<Response> put(BodyGenerator bodyGenerator) throws IOException ; | |
public Future<Response> get(BodyConsumer bodyConsumer) throws IOException ; | |
public Future<Response> delete() throws IOException ; | |
public Future<Response> delete(BodyConsumer bodyConsumer) throws IOException; | |
public Future<Response> head() throws IOException | |
public Future<Response> options() throws IOException ; | |
public Future<Response> options(BodyConsumer bodyConsumer) throws IOException ; | |
public Future<Response> trace() throws IOException ; | |
public Future<Response> trace(BodyConsumer bodyConsumer) throws IOException ; | |
// Can be used like this. BodyConsumer and BobyGenerator will be added to the lib like InputStreamBodyGenerator, | |
// FileBodyConsumer, etc. | |
SimpleAsyncHttpClient client = new SimpleAsyncHttpClient.Builder() | |
.setUrl("http://..") | |
.setProxyHost("http://...") | |
.addHeader("foo","bar") | |
.setRealmPrincipal("me") | |
.setRealmPassword("pwd") | |
.build(); | |
OutputStream stream = ....; | |
client.get(new OutputStreamBodyConsumer(stream)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment