Inject the response with the PDF payload and appropriate Content-Type header

@param  ViewEvent $e
@return void
773243
public function injectResponse(ViewEvent $e)
    {
        $renderer = $e->getRenderer();
        if ($renderer !== $this->renderer) {
            // Discovered renderer is not ours; do nothing
            return;
        }

        $result = $e->getResult();

        if (!is_string($result)) {
            // @todo Potentially throw an exception here since we should *always* get back a result.
            return;
        }

        $response = $e->getResponse();
        $response->setContent($result);
        $response->getHeaders()->addHeaderLine('content-type', 'application/pdf');

        $fileName = $e->getModel()->getOption('filename');
        if (isset($fileName)) {
            if (substr($fileName, -4) != '.pdf') {
                $fileName .= '.pdf';
            }

            $response->getHeaders()->addHeaderLine(
                'Content-Disposition',
                'attachment; filename=' . $fileName
            );
        }
    }
113887
protected function handleException($request, Exception $e)
    {
        $this->reportException($e);

        return $this->renderException($request, $e);
    }
727118
public function injectAccessDeniedViewModel(MvcEvent $event)
    {
        $this->config($event);
        
        $result = $event->getResult();
        
        if ($result instanceof ResponseInterface) {
            return;
        }
        
        $response = $event->getResponse();
        
        if ($response->getStatusCode() != 403) {
            return;
        }
        
        $model = new ViewModel();
        $model->setTemplate($this->template);
        
        if ($this->renderLayout == true) {
            $layout = $event->getViewModel();
            $layout->addChild($model);
        } else {
            $model->setTerminal(true);
            $event->setViewModel($model);
        }
    }
979375
private function renderResponse($viewType, array $templateParams = [], $widget = false)
    {
        return new Response($this->renderTemplate($viewType, $templateParams, $widget));
    }
910883
public function onKernelResponse(FilterResponseEvent $event): void
    {
        $apiDocUrl = $this->urlGenerator->generate('api_doc', ['_format' => 'jsonld'], UrlGeneratorInterface::ABS_URL);
        $link = new Link(ContextBuilder::HYDRA_NS.'apiDocumentation', $apiDocUrl);

        $attributes = $event->getRequest()->attributes;
        if (null === $linkProvider = $attributes->get('_links')) {
            $attributes->set('_links', new GenericLinkProvider([$link]));

            return;
        }
        $attributes->set('_links', $linkProvider->withLink($link));
    }
925637
public function setDateFormat(Event $e)
    {
        /* @var EventsForm $form */
        $form = $e->getParam('form');
        /* @var EventsHydrator $hydrator */
        $hydrator = $form->getHydrator();
        /* @var DateTime $dateTimeStrategy */
        $dateTimeStrategy = $hydrator->getStrategy('dateTime');
        $dateTimeStrategy->setHydrateFormat($this->getOptions()->getDateFormat());
    }
1074504
public function createResponse(ViewHandler $handler, View $view, Request $request, string $format): Response
    {
        $view->setHeaders(
            [
                'X-Content-Type-Options' => 'nosniff',
                'Content-Security-Policy' => "default-src 'none'",
                'X-Frame-Options' => 'DENY',
            ]
        );

        return $handler->createResponse($view, $request, $format);
    }
319235
function onRenderRenderWidgets(ViewEvent $e)
    {
        $viewModel = $e->getModel();

        $return = false;

        $options = $viewModel->getOptions();
        if (/*!array_key_exists('has_parent', $options) &&*/ !self::$resolved) {
            $return = new PhpRenderer;
            $return->setServiceLocator($this->sm);

             //self::$resolved = true;
        }

        return $return;
    }
96808
public function onKernelResponse(FilterResponseEvent $event)
    {
        $response = $event->getResponse();

        if ($response instanceof SerializedResponse) {
            $acceptableContentTypes = $event->getRequest()->getAcceptableContentTypes();

            $format = 'json';

            foreach ($acceptableContentTypes as $item) {
                if (strpos($item, 'xml') !== false) {
                    $format = 'xml';
                    break;
                }
            }

            $serializedData = $this->serializer->serialize($response->getData(), $format, null);

            $response->setContent($serializedData);
        }
    }
361804
public function setUseCapture(MvcEvent $e)
    {
        if (!$e->getRequest() instanceof HttpRequest || !($options = $e->getParam('module-options'))) {
            return;
        }

        if ($options instanceof FormOptionsInterface && null === $options->getUseCaptcha()) {
            $authService = $e->getApplication()->getServiceManager()
                ->get(AuthenticationServiceInterface::class);
            $options->setUseCaptcha(!$authService->hasIdentity());
        }
    }
702317
public function injectResponse(ViewEvent $e)
    {
        $renderer = $e->getRenderer();
        if($renderer !== $this->renderer) {
            // not our renderer
            return;
        }

        $result = $e->getResult();
        $response = $e->getResponse();

        $response->setContent($result);
    }
981595
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;
    }
623052
public function injectLinkHeader(MvcEvent $e)
    {
    	$response = $e->getResponse();
    	$headers  = $response->getHeaders();
//     	$headers->addHeaderLine('Link', sprintf(
// 			'<%s>; rel="describedby"',
// 			$this->url()->fromRoute('static-classified-service')
//     	));
    	$headers->addHeaderLine('Access-Control-Allow-Origin', '*');
    	$headers->addHeaderLine('Access-Control-Allow-Methods', 'POST PUT DELETE GET');
    	 
    }
917897
public function onKernelRequest(GetResponseEvent $event): void
    {
        foreach ($this->extensions as $extension) {
            if (!class_exists($extension) || !is_a($extension, ExtensionInterface::class, true)) {
                continue;
            }

            if ($this->twig->hasExtension($extension)) {
                continue;
            }

            $this->twig->addExtension(new $extension());
        }
    }
790890
public function onKernelTerminate(PostResponseEvent $e)
    {
        if (!$this->enabled) return;

        $e->getDispatcher()->dispatch(self::API_TERMINATE, $e);
    }
885091
public function selectRenderer(ViewEvent $e)
    {
        $model = $e->getModel();

        if ($model instanceof NewsletterViewModel) {
            return $this->renderer;
        }

        return false;
    }
1027546
public function processRcmResponses(ViewEvent $event)
    {
        $response = $event->getResponse();
        if (!$response instanceof RcmResponse) {
            return null;
        }

        $this->responseHandler->processResponse($response);
        return null;
    }