mercredi 23 mai 2012

RESTful client in Java with JAX-RS 2.0 Client API (JSON update)


When I wrote RESTful client in Java with JAX-RS 2.0 Client API, I thought that JSON serialization/deserialization was not working with Jersey 2.0-m3.
But, in fact, it works as designed and Martin Matula gives us the solution in his second comment and in JIRA).
To use the JSON serialization/deserialization (with Jersey 2.0m3), you have to:
  •  enable the JsonFeature on the client with the line:
    client.configuration().enable(new JsonFeature());
  •  and add the jars:
    jersey-media-json-2.0, jackson-jaxrs, jackson-core-asl, jackson-mapper-asl and jackson-xc

jeudi 10 mai 2012

RESTful client in Java with JAX-RS 2.0 Client API


On october 21th 2010, I wrote a RESTful client in Java. We are now in 2012, and the next version of JAX-RS (the 2.0 and which will be included as part of Java EE 7) will include a client API.

The JAX-RS 2.0 specification is still work in progress, but a few implementations already exist (in beta or in the first milestones).

To begin to explore the JAX-RS Client API, I decided to use the Jerseyimplementation (which is the JAX-RS's reference implementation) and the same RESTful service that I used in RESTful client in JAVA.