public function onKernelRequest(RestEvent $event)
    {
        $request = $event->getRequest();

        if ($request->headers->has('Accept')) {
            $format = $request->getFormat($request->headers->get('Accept'));
            if (empty($format)) {
                foreach ($this->container->getParameter('graviton.rest.special_mimetypes') as $format => $types) {
                    $mimetypes = $request->getMimeType($format);

                    if (!empty($mimetypes)) {
                        $mimetypes = is_array($mimetypes)? $mimetypes : array($mimetypes);
                        $types = array_unique(array_merge_recursive($mimetypes, $types));
                    }

                    $request->setFormat($format, $types);
                }
            }
        }
    }