Help is available by sending an email to csf-support@mit.edu
Have any suggestion on how improve this wiki?  Please give us your feedback at csf-support@mit.edu

July 2012

We are deprecating DWR in favor of Spring MVC Controllers. Controller methods can be invoked via AJAX and can return JSON-formatted data. More information to follow.

REST APIs

We should now use REST-style APIs implemented with Spring MVC Controllers to support web client access to server-side resources. The REST APIs will support AJAX calls from components on web pages in addition to other arbitrary HTTP based clients. REST APIs are most commonly implemented using the HTTP protocol. The APIs are focused on resources. Characteristics of an HTTP-based REST-style API are:

  • Stateless request-and-response format (like traditional web)
  • Client requests action on a resource via:
    • URI in a standard form - specifies the resource(s) we are interested in
    • HTTP Method (GET, POST, PUT, or DELETE) - specifies the action to be applied to the resource(s)
    • Possibly sending representation of resource(s) to server
  • Server responds with:
    •  HTTP response code
    • Possibly some "representation" of resource(s)
  • All of the information needed for action is included in the request. No reliance is made on state stored by the server (e.g. in the session)
  • Each resource has a unique identifier
  • Associated resources are represented with hyperlinks (like traditional web)
  • Client can request data in a particular format (e.g. XML or JSON)
  • Data can be returned in various formats, XML and JSON being the most common.
  • No labels