Add "format" support to the Request object
The Request object (mainly WebRequest) should contain information about the requested format. Currently it only provides a controller and an action name.
The default format would be "html" for web requests and "text" for CLI requests.
The router which extracts information for building a web request could determine the requested format from two sources:
- the file extension (.html, .txt, .pdf, .js, .json, .atom, .rss, .xml etc.)
- the HTTP headers (content negotiation) - this is mainly for AJAX requests
Updated by Robert Lemke almost 11 years ago
- Status changed from Accepted to Resolved
- % Done changed from 50 to 100
Okay, as it seems the Accept header is not used consistently and correctly among different browser (see http://www.gethifi.com/blog/browser-rest-http-accept-headers) and that even if it was, there are a number of reasons why multiple URLs for different formats is the better design choice (see also http://www.artima.com/weblogs/viewpost.jsp?thread=192218).
Therefore I drop the idea of built-in content negotiation, at least for now.