public function createResponse(ViewHandler $handler, View $view, Request $request, $format)
    {
        $response = $handler->createResponse($view, $request, 'json');

        if ($response->isSuccessful()) {
            $callback = $this->getCallback($request);
            $response->setContent(sprintf('/**/%s(%s)', $callback, $response->getContent()));
            $response->headers->set('Content-Type', $request->getMimeType($format));
        }

        return $response;
    }
public function createResponse(ViewHandler $handler, View $view, Request $request, $format)
    {
        $response = $handler->createResponse($view, $request, 'json');

        if ($response->isSuccessful()) {
            $callback = $this->getCallback($request);
            $response->setContent(sprintf('/**/%s(%s)', $callback, $response->getContent()));
            $response->headers->set('Content-Type', $request->getMimeType($format));
        }

        return $response;
    }
public function createResponse ( ViewHandler $ handler , View $ view , Request $ request , $ format ) { $ response = $ handler -> createResponse ( $ view , $ request , 'json' ) ; if ( $ response -> isSuccessful ( ) ) { $ callback = $ this -> getCallback ( $ request ) ; $ response -> setContent ( sprintf ( '/**/%s(%s)' , $ callback , $ response -> getContent ( ) ) ) ; $ response -> headers -> set ( 'Content-Type' , $ request -> getMimeType ( $ format ) ) ; } return $ response ; }
Handles wrapping a JSON response into a JSONP response.

@param ViewHandler $handler
@param View        $view
@param Request     $request
@param string      $format

@return Response
Handles wrapping a JSON response into a JSONP response .