Spring adds HATEOAS Support to REST Based Web Services
The Spring Framework for Java is currently in progress of adding HATEOAS, Hypermedia As The Engine Of Application State, support for hyper-text driven REST web services. Primary focus for the library is to provide an API for simplifying the creation of hypermedia links and assembling of REST resource representations when used together with Spring and especially Spring MVC.
XML and JSON
The library provides a set of types to simplify working with both XML and JSON.
Several classes are provided for working with links and relations.
The Link class is used for creating and holding links, using the Atom link definition with a rel and a href attribute for describing a link. When using XML the link representation will be rendered in the Atom namespace.
A common problem when creating URI strings is the spread of duplicate string constants over the code base. The ControllerLinkBuilder class addresses this problem by extracting the base URI from the current request and then adding the root mapping from the Controller class for the corresponding resource to get a complete URI.
When resources are direct representations of model classes, classes are provided for creating links for these model types, pointing to either a collection resource or a single resource.
Finding the link corresponding to a given relation is a common task when using hypermedia. Support for this is provided through a LinkDiscoverer class.
When creating resource classes, the library contains a base class, ResourceSupport, to inherit from, e.g. for links support.
Another base class, ResourceAssemblerSupport, helps reducing the amount of code needed for mapping between entities and resources and for adding links to a resource. This assembler class is furthermore capable of creating a single resource or a collection of resources.
How Can We Use Our Creative Power and Technological Opportunity to Address the Challenges of the 21st Century?
Gyorgyi Galik Feb 26, 2015