Prev | Current Page 291 | Next

Brad Ediger

"Advanced Rails"


Selecting a representation
One detail unspecified by REST is how a client requests a particular content type. As
many representations may be available from the same resource, how does the server
know which one to send?
In practice, the answer is either URI extensions or content negotiation. Extensions
are easy to understand and implement: the URI is examined for a filename extension
(such as .js, .html, or .xml). The most suitable representation is then selected based
on a type map (a structure that maps filename extensions to content types). For
example, fetching the URI /orders/124.html might return:
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


Viewing Order #124

Hypermedia Drives Application State
An oft-repeated mantra (originally from Fielding??™s thesis) is that of ???hypermedia as the
engine of application state.??? In other words, given an entry point to a RESTful application,
hypermedia links can be used to navigate through all necessary application
state. This makes applications more resilient to name changes, as the only URI the client
must know is that of the entry point. In addition, URIs can be treated as opaque if
desired. This is obviously a desirable architectural quality, as it enables more options.
However, there are not many true implementations of this in the wild.


Pages:
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303