There has been some very interesting activity in JCP land lately, namely acceptance of new Date and Time API (JSR 310) and proposal of the JavaTM API for RESTful Web Services (JSR 311).
Usual first reactions to the JSR 310 that I saw on the web were “finally” or “too late”, but I think that “better late then never” should be applied in this case. People behind this specification are developers of Joda time and this API will be heavily based on Joda time, which has been an excellent replacement for traditional Java date/calendar API (and must-have tool in your toolbox) for years. Beside the initial goal, to provide lightweight and simple API, one of the area of interest will be interoperability with JDBC. The general attitude toward this spec is maybe best described by the Google’s voting comment:
On 2007-01-30 Google Inc. voted Yes with the following comment:
We are thrilled to see this happen!
Hopefully, this specification will be included in Java 7.
Now back to the RESTful Web Services and the specification request 311. Although it is not crucial part of the language as Date/Time API, I think that this specification deserves to pass approval process and we (Java developers) deserve to have standard API to deal with RESTfull web services.
The introductory example, from Marc Hadley (one of the spec leads) looks promising
@UriTemplate("widgets/{widgetid}")
@ConsumeMime("application/widgets+xml")
@ProduceMime("application/widgets+xml")
public class Widget {
@HttpMethod(GET)
public Representation getWidget(@UriParam("widgetid") String id) {
String replyStr = getWidgetAsXml(id);
return new StringRepresentation(replyStr,
"application/widgets+xml");
}
@HttpMethod(PUT)
public void updateWidget(@UriParam("widgetid") String id,
Representation
but I’ll second usual comments found on this topic: “I hope that they don’t screw it up”.