Implement Content Negotiation Support
There is now a use case for content negotiation in FLOW3:
For most requests, content negotiation based on the Accept HTTP header does not make sense because most browsers don't send meaningful information in them (some browsers for example say that they prefer "XML" over "HTML" which the user of course doesn't). However, for REST services it is a handy feature to control the output format by sending a respective Accept header. In some cases this might even be the only way to control the format, for example how else would you GET a resource "http://myhost/customers/" in different formats?
A proper implementation could work like this:
- if a format is defined through a @format property in the matching route, this format is used
- if no format has been defined by the route, the Accept header will be analyzed and compared with a list of supported formats by the controller. If another format than "HTML" is accepted by the client and the controller supports it, this format is chosen. If no other accepted format matches the supported formats, HTML is used.
[+FEATURE] FLOW3 (MVC): Content Negotiation support in ActionController
This adds support for content negotiation based on the Accept HTTP header.
If a format other than "html" is accepted by the client and the format is
listed in a controller's "supportedFormats" array, this format is chosen.
If a format has been explicitly defined through a @format property of the
current route, that format is used instead.
In any other case "html" is used for web requests and "txt" for command line