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

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

03.25.2011
| 2621 views |
  • submit to reddit
Location: 
San Francisco

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

It’s surprisingly complex to do the simplest HTTP calls with the standard Java library. Resty hopes to change that.

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

Check it out here: http://beders.github.com/Resty/Resty/Overview.html

Example code for using the Yahoo Search Webservice, parsing the result as XML and getting the title of the first result as String.

Resty r = new Resty();
String firstResult = r.xml("http://api.search.yahoo.com/WebSearchService/V1/webSearch",
form("appid=YahooDemo&query=Resty+java&results=10"))
.get("/ResultSet/Result[1]/Title",String.class);

 

New in version 0.2.0: Support for PUT, DELETE, application/multipart-formdata

 

0
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.)

Tags: