Java RESTful clients and JAX-RS
Before I get into the specifics of each client, I'll take the liberty to categorize different types/levels of RESTful clients I've seen that come bundled with JAX-RS projects:
Raw Data Communication - There are existing client APIs such as java.net.URL and URLConnection and the more versatile HTTPClient. The java.net infrastructure allows you to make connections and get/post data. HTTPClient is more powerful than URLConnection, and provides lots of ways to manage the communication process but doesn't address how you should interpret the results of a GET into a Java object or convert a Java object into data for a POST.
Theoretically, clients with JAXB2 can be used to read data from any RESTful service. Write your service in Rails, Grails, or DJango and use that service with a "JAX-RS" client.
Service Proxy - JAX-RS provides a nice abstraction on how you map a URL to a service layer method and of course how you transform XML into an object (and vice versa). Some JAX-RS clients promote creating a Java interface on which you put your JAX-RS annotations. Those JAX-RS implementations then allow you to create a proxy to the remote services using that same Java interface coupled with a root URL. Those client proxies reduce boiler plate code considerably.
Theoretically, the service proxy approach can be flexible enough to perform a whole bunch of custom modifications to the communication process to perform "cross-cutting" functionality like security management and custom business logic related to the communication. One of my favorite custom cross-cutting business logic scenarios is "time-machine functionality" which involves adding some common URL parameters (&date=...). Additionally, this approach can theoretically be used when communicating with non-JAX-RS implemented services (Rails...).
This entry is part of my ongoing comparisons of JAX-RS frameworks. My next entry will include snippets collected from blogs and sample applications on how each of the four JAX-RS frameworks implements much needed RESTful client. I'll throw in some implementations of URLConnection and HTTPClient code as well.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)