Feature #10680

Implement Content Negotiation Support

Added by Robert Lemke over 9 years ago. Updated over 9 years ago.

Should have
Start date:
Due date:
% Done:


PHP Version:
Has patch:


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.

Related issues

Related to TYPO3.Flow - Feature #315: Add "format" support to the Request object Resolved 2008-02-15
Related to TYPO3.Flow - Feature #37561: Re-implement Accept Header / Content Negotiation support Resolved 2012-05-29

Associated revisions

Revision ec2b14d3 (diff)
Added by Robert Lemke over 9 years ago

[+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
requests respectively.

Resolves: #10680
Resolves: #10681
Relates to: #9475

Change-Id: I9385a7284433ef9d741e96593bdbe1c0a3060daa


#1 Updated by Robert Lemke over 9 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF