Step 3: Listener support
========================

`Listeners`_ are a way to hook into the request handling. This Bundle provides
various events from decoding the request content in the request (body listener),
determining the correct response format (format listener), reading parameters
from the request (parameter fetcher listener), to formatting the response either
with a template engine like twig or (for example) to xml or json using a serializer 
(view response listener) as well as automatically setting the accepted HTTP methods
in the response (accept listener).

With this in mind we will now explain each one of them.

All listeners except the ``mime_type`` listener are disabled by default. You
can enable one or more of these listeners. For example, below you can see how
to enable a few additional listeners:
Status code when responding with no content
===========================================

In some use cases the api should not send any content, especially when deleting (*DELETE*) or updating (*PUT* or *PATCH*) a resource.

By default, ``FOSRestBundle`` will send a *204* status if the response is empty.
If you want to use another status code for empty responses, you can update your configuration file:

.. code-block:: yaml

    fos_rest:
        view:
            empty_content: 204

.. versionadded:: 2.0
  Until FOSRestBundle 2.0 this code will be used even if another code is configured manually inside the view object!

If you don't want to use the default empty content status for a specific empty ``Response``, you just
have to set a status code manually thanks to the ``@View()`` annotation or the ``View`` class.
