/**
  * @param Request $request
  * @return string
  */
 protected function getCallbackFromRequest(Request $request)
 {
     $response = new JsonResponse('');
     $response->setCallback($request->query->get(self::PARAMETER_CALLBACK));
     return $response->getCallback();
 }
 /**
  * @param Request $request
  * @param JsonResponse $response
  */
 protected function wrapResponse(Request $request, JsonResponse $response)
 {
     switch ($request->query->get(self::PARAMETER_WRAPPER)) {
         case self::WRAPPER_POST_MESSAGE:
             $response->setContent($this->twig->render('MediaMonksRestApiBundle::post_message.html.twig', ['request' => $request, 'response' => $response, 'callback' => $request->query->get(self::PARAMETER_CALLBACK), 'origin' => $this->getPostMessageOrigin()]))->headers->set('Content-Type', 'text/html');
             break;
         default:
             $response->setCallback($request->query->get(self::PARAMETER_CALLBACK));
             break;
     }
 }