Jochen has posted 2 posts at DZone. View Full User Profile

Resty for Java - a simple, light-weight HTTP/REST client API

  • submit to reddit
San Francisco

Tired of using tons of code around URLConnection?  Apache HTTP client too complex? Jersey client too fickle?

Maybe Resty is to your liking then.

Resty is a small, convenient API to talk to RESTful services from Java.

Its focus is on simplicity and ease-of-use, often requiring only two lines of code to access RESTful web services.

Basic usage is very simple:
Create a Resty instance, then call one of the content type specific methods to GET  the contents of an UR (or POST to it and stuff).

Here is an example on how to use the geonames web service. It retrieves the JSON object and gets the name of a place from the zip code using an JasonPath or XPath-like expression:

Resty r = new Resty();
String name = r.json("").

 More on

 Hosted over at github. Come over and help out. It's fun!

Published at DZone with permission of its author, Jochen Bedersdorfer.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)