Monday Mar 17, 2014

The JAX-RS 2 Client API by Example

The brand new client API is one of the most significant features introduced in JAX-RS 2/Java EE 7. The API has many uses such as unit/integration testing, system-to-system/M2M communication, Java SE/AWT/Swing/JavaFX REST clients and so on. Indeed you can think of the JAX-RS 2 client API as a general purpose replacement to java.net.URL/URLConnection for any HTTP communication. In an excellent recent blog post, Micha Kop introduces the major features of the JAX-RS 2 client API in an example driven fashion. He demonstrates doing a basic POST/GET/DELETE request, JSON support, resolving path parameters, asynchronous processing, invocation callbacks, delayed invocation, filters and much more (all with running examples included!). JAX-RS 2 specification leads Santiago Pericas-Geertsen and Marek Potociar also spent a great deal of time on the client API during their JavaOne 2013 talk (video embedded below).

The official Java EE 7 tutorial also has a great section on the JAX-RS 2 client API, as does the docs for the Jersey JAX-RS 2 reference implementation.

Friday Jan 31, 2014

JAX-RS Managed Clients in Jersey

As you probably know, JAX-RS 2/Java EE 7 now includes a brand new standard client API. If you don't know about it yet, you should check out this excellent blog entry by Mohamed Sanaulla now :-). The standard client API uses the factory/builder patterns and not injection. This makes it very well suited for Java SE based environments such as JUnit tests and JavaFX UIs. However Jersey, the JAX-RS 2 reference implemention included in GlassFish 4 goes much further by providing a managed JAX-RS client that makes full use of injection. This is ideal for server-side mash-ups and system-to-system/machine-to-machine communication.

Michal Gajdos of the Jersey team does an excellent job of explaining the API details in this code-driven blog entry. You can also check out the code on GitHub and running example on Heroku!

Monday Dec 23, 2013

Java EE@Oredev 2013

Oredev 2013 was held on 4-8 November in Malmo Sweden. This was my second time at the largest IT conference in the Scania region - I had been there in 2010 as an independent. This year it attracted a decent section of the Java crowd including my fellow Oracle colleagues Brian Goetz, Geertjan Wielenga, Attila Szegedi, Aleksey Shipilev, Cecilia Borg, Marcus Hirt and Tomas Nilsson as well as independent Adam Bien. Topics covered included Java EE, mobile, DDD, agile, HTML5, cloud, Java SE, OpenJDK, JavaScript and NoSQL.

I delivered a full day workshop on Java EE 7 and a technical talk on JAX-RS 2, both of which went well. More details on the sessions and Oredev, including the slide deck and code, posted on my personal blog.