Every Request has a "format" (e.g. html, json), which is used
to determine what type of content to return in the Response. In fact,
the request format, accessible via
getRequestFormat(),
is used to set the MIME type of the Content-Type header on the Response
object. Internally, Symfony contains a map of the most common formats (e.g.
html, json) and their associated MIME types (e.g. text/html,
application/json). Of course, additional format-MIME type entries can
easily be added. This document will show how you can add the jsonp format
and corresponding MIME type.

The key to defining a new MIME type is to create a class that will "listen" to
the kernel.request event dispatched by the Symfony kernel. The
kernel.request event is dispatched early in Symfony's request handling
process and allows you to modify the request object.

Create the following class, replacing the path with a path to a bundle in your
project: