Java, Web, REST, Hypermedia, XHTML, Seam
November 7, 2012

Hypermedia with XHTML

XHTML has been one of my favorite text file formats for the last five years. This website uses it internally, try the same HTTP request with an .xhtml extension. I'm currently writing a book in my IDE in XHTML. All my Java unit tests have XHTML Javadoc, and I create my software manuals from and with XHTML. Even presentation slides I write in XHTML, with a simple 20 line Javascript player.

Back in 2008 at a developer meeting, we discussed the future client side of the Seam framework project. One of major items were rich clients, and how we could go beyond server-rendered JSF pages. The first step was to make creation of HTTP remote interfaces easier, so we integrated with a JAX-RS implementation. There was still an open TODO item, the actual representation of state in hypermedia. Sure, you could easily transform JPA entity data to and from JSON or your own XML dialect, but you wouldn't really get HATEOAS for free. We thought about using XHTML for hypermedia, as it was already the primary template format for JSF.

Since then I've worked on other things, but always had this problem as "unsolved" in my mind. A few months ago, I decided to get an update. I found that Jon Moore wrote several interesting blog articles (1, 2, 3). The real highlight however is his Hypermedia APIs presentation (watch video). He shows how Independent evolution and Decoupled implementation actually look like with a nice client/server demo application. It's not a short presentation, but well worth your time.

I can also recommend the book Building Hypermedia APIs for a cross-platform perspective and some background information.

Jon Moore's presentation Java demo code, at least a part of it, has been released here. I think someone should write a generic JAX-RS server-side framework for this, and a GWT client, and an Android client, or to cover it all, a Restlet client.