Skip to content

protolab/simple-http-client

Repository files navigation

simple-http-client

Provides the "façade" API for the core parts of the Google HTTP Java Client library.

Samples

  • Minimal example.
HttpClient c = HttpClient.newInstance();
GenericUrl url = new GenericUrl("http://en.wikipedia.org/wiki/Special:Random");
HttpResponse resp = c.get(url);
if (resp.isSuccessStatusCode())
    // process the response
else
    // handle an HTTP error response
  • More advanced
HttpClient c = new HttpClient.Builder()
                 .userAgent("HttpClient/1.0.0 (Google Java HTTP Client)")
                 .accept("application/json")
                 .build();
GenericUrl url = new GenericUrl("https://api.github.com/users/protolab");
HttpResponse resp = c.get(url);
if (resp.isSuccessStatusCode())
    // process JSON response
else
    // handle an HTTP error response

Dependencies

About

A lightweight wrapper around Google HTTP Java Client

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages