JSR-311: a Java API for RESTful Web Services?
By bblfish on Feb 14, 2007
JSR 311: Java (TM) API for RESTful Web Services has been put forward by Marc Hadley and Paul Sandoz from Sun. The initial expert membership group come from Apache, BEA, Google, JBoss, Jerome Louvel of the very nice RESTlet framework, and TmaxSoft.
Remember, these are the same jokers who gave us servlets and the URLConnection class as well as gems like JAX-RPC and JAX-WS. They still seem to believe that these are actually good specs, and they are proposing to tunnel REST services through JAX-WS (Java API for XML Web Services) endpoints.
They also seem to believe that "building RESTful Web services using the Java Platform is significantly more complex than building SOAP-based services". I don't know that this is false, but if it's true it's only because Sun's HTTP API were designed by architecture astronauts who didn't actually understand HTTP. This proposal does not seem to be addressing the need for a decent HTTP API on either the client or server side that actually follows RESTful principles instead of fighting against them.
To give you an idea of the background we're dealing with here, one of the two people who wrote the proposal "represents Sun on the W3C XML Protocol and W3C WS-Addressing working groups where he is co-editor of the SOAP 1.2 and WS-Addressing 1.0 specifications. Marc was co-specification lead for JAX-WS 2.0 (the Java API for Web Services) developed at the JCP and has also served as Sun's technical lead and alternate board member at the Web Services Interoperability Organization (WS-I)."
Heavy words indeed.Roy fielding is dead against the name
Marc, I already explained to Rajiv last November that I would not allow Sun to go forward with the REST name in the API. It doesn't make any sense to name one API as the RESTful API for Java, and I simply cannot allow Sun to claim ownership of the name (which is what the JSR process does by design). Change the API name to something neutral, like JAX-RS.
I am still not so sure what they want to do exactly, but it seems to be based on JRA which has annotations of the form:
@Get @HttpResource(location="/customers") public List<Customer> getCustomers(); @Post @HttpResource(location="/customers") public void addCustomer(Customer customer);which frankly does seem a little weird. But I am willing to give it some time to understand. Marc Hadley has more details about what he is thinking of.
If one were to standardize an api why not standardize the RESTlet API? That makes more immediate sense to me. It is working code, people are already participating in the process, and the feedback is very good. Now I don't know exactly how JSRs work and what the relationship is between the initial proposal and the final solution. Is the final proposal going to be close to the current one, with those types of annotations? Or could it be something much closer to RESTlets?
On the other hand I am pleased to see a JSR that is proposing to standardise annotations. That makes me think it would probably the time may be ripe to think of standardize the
@rdf annotations mapping POJOs to the semantic web the way so(m)mer and elmo are doing.
- InfoQ article on this subject: New JSR Proposed: Java API for RESTful Web Services
- Marc Hadley, spec lead of JSR 311, gives an outline in his blog
- Jerome Louvel, author of the Java RESTlet framework, has written New JSR to define a high-level REST API for Java
- Eliot Rusty Harold just published more detailed and leveled explanation of his position on his cafeaulait blog.
- the CFX HTTP Binding doc that seems to be behind some of the thinking leading this JSR. This explains the Java REST annotations mentioned earlier.
- A further thread started by Eliot "Another potential problem with the 311 proposal" with a good discussion between him and Jérôme Louvel on the RESTlet API. This is the beginning of a good discussion on RESTlets. I am not yet convinced that one needs to have both a client and a server side API for REST. But some good points are starting to be made here.
Some blogs on the subject:
- Tim Bray is collecting a few thoughts
- Alexis Moussine-Pouchkine's writes JSR 311 - Quick follow-up thoughts
- Dave Johnson's javax.ws.rest" entry
- Dan Diephouse who worked on the Java REST annotations, explains this in "javax.ws.rest"
- Andrew Newman's post "All Annotations" quotes me here. I changed this post since his quote, but his quote is still valid.
Off topic: Eliott Rusty Harold recently wrote up 10 predictions for xml in 2007 where he gives a very partial description of RDF, correctly pointing out the importance of GRDDL, but completely missing out the importance of SPARQL.