add our Link header items

@param FilterResponseEvent      $event      response listener event
@param string                   $eventName  event name
@param EventDispatcherInterface $dispatcher dispatcher

@return void
358155
public function onKernelResponse(FilterResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $response = $event->getResponse();
        $request = $event->getRequest();

        // extract various info from route
        $routeName = $request->get('_route');
        $routeParts = explode('.', $routeName);
        $routeType = end($routeParts);

        $this->linkHeader = LinkHeader::fromResponse($response);

        // add common headers
        $this->addCommonHeaders($request, $response);

        // add self Link header
        $selfUrl = $this->addSelfLinkHeader($routeName, $routeType, $request);
        // dispatch this!

        // add paging Link element when applicable
        if ($routeType == 'all' && $request->attributes->get('paging')) {
            $this->generatePagingLinksHeaders($routeName, $request, $response);
        }

        // add schema link header element
        $this->generateSchemaLinkHeader($routeName, $request, $response);

        // finally set link header
        $response->headers->set(
            'Link',
            (string) $this->linkHeader
        );

        $event->setResponse($response);

        // dispatch the "selfaware" event
        $event->getRequest()->attributes->set('selfLink', $selfUrl);
        $dispatcher->dispatch('graviton.rest.response.selfaware', $event);
    }
1192475
public function onKernelResponse(FilterResponseEvent $event)
    {
        // do not capture redirects or modify XML HTTP Requests
        if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()
                || 'html' !== $event->getRequest()->getRequestFormat()
                || self::ENV_ENABLED === $this->env) {
            return;
        }

        $response = $event->getResponse();
        $contentType = $response->headers->get('content-type');

        // only html content
        if (false === strpos($contentType, 'text/html')) {
            return;
        }

        $content = $response->getContent();
        $content = preg_replace('/(\n[\s]+)|\n/', '', $content);
        $content = preg_replace('/\s\s+/', ' ', $content);
        $response->setContent($content);
    }
973912
public function authenticate(FilterUserResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        try {
            $this->loginManager->logInUser($this->firewallName, $event->getUser(), $event->getResponse());

            $dispatcher->dispatch(Events::SECURITY_IMPLICIT_LOGIN, new UserEvent($event->getUser(), $event->getRequest()));
        } catch (AccountStatusException $e) {
            // We simply do not authenticate users which do not pass the user
            // checker (not enabled, expired, etc.).
        }
    }
898644
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest())
        {
            return;
        }

        $attributes = $event->getRequest()->attributes->all();

        if( array_key_exists('_callable', $attributes) && array_key_exists('0', $attributes['_callable']) && is_object($attributes['_callable'][0]))
        {
            $attributes['_callable'][0]->postAction();
        }
    }
1222965
public function viewCheck(ViewCheckEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if ($event->getView() == 'category') {
            $category = CategoryQuery::create()
                ->filterById($event->getViewId())
                ->filterByVisible(1)
                ->count();

            if ($category == 0) {
                $dispatcher->dispatch(TheliaEvents::VIEW_CATEGORY_ID_NOT_VISIBLE, $event);
            }
        }
    }
1174007
public function delete(FeatureDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== ($feature = FeatureQuery::create()->findPk($event->getFeatureId()))) {
            $feature
                ->setDispatcher($dispatcher)
                ->delete()
            ;

            $event->setFeature($feature);
        }
    }
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);
        }
    }
402630
public function onLoadQueueListenerRun(LoadQueueEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $query  = $event->getQuery();
        $result = $this->database->execute($query);
        $event->setEvents($result);
    }
1138887
public function onKernelResponse(FilterResponseEvent $event)
    {
        $event->getResponse()->headers->set(
            'Content-Language',
            implode(', ', $this->utils->getLanguages())
        );
    }
862703
public function onResponse(FilterResponseEvent $event)
    {
        // $response = $event->getResponse();
        // $headers  = $response->headers;

        // $headers->set('Content-Length', 11);

        // if (!$headers->has('Content-Length') && !$headers->has('Transfer-Encoding')) {
        //     $headers->set('Content-Length', strlen($response->getContent()));
        // }



        $request = $event->getRequest();
        $response = $event->getResponse();

        if ('HEAD' === $request->getMethod()) {
            // cf. RFC2616 14.13
            $length = $response->headers->get('Content-Length');
            $response->setContent('');
            if ($length) {
                $response->headers->set('Content-Length', $length);
            }
        }

        if ($response->getCharset() === null) {
            $response->setCharset($this->charset);
        }

        $annotations = $event->getAnnotations();

        // override headers from annotations
        if ($annotations instanceof ResponseAnnotation) {
            $annotatedHeaders = $annotations->getHeaders();

            foreach ($annotatedHeaders as $key => $value) {
                $response->headers->set($key, $value);
            }
        }
        // end annotated headers

        if ($response->headers->has('Content-Type')) {
            return;
        }

        $format = $request->getRequestFormat();

        if (($format !== null) && ($mimeType = $request->getMimeType($format))) {
            $response->headers->set('Content-Type', $mimeType);
        }
    }
908848
public function setCurrentVersionHeader(FilterResponseEvent $event)
    {
        if ($this->version) {
            $event->getResponse()->headers->set(self::HEADER_NAME, $this->version);
        }
    }
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));
    }
1126318
public function onResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $request = $event->getRequest();
        if (Zone::isAsync($request) || $request->isXmlHttpRequest()) {
            return;
        }

        $response = $event->getResponse();
        if ($response->isRedirection() || $response->isEmpty() || $response->isInformational()) {
            return;
        }
        if (strpos($response->headers->get('Content-Type'), 'text/html') === false) {
            return;
        }

        $this->addSnippets();

        foreach ($this->queues as $queue) {
            $queue->process($request, $response);
        }
    }
1078040
public function onKernelResponse(FilterResponseEvent $event)
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        if (!preg_match(static::USER_AGENT_REGEX, $event->getRequest()->headers->get('User-Agent'))) {
            $this->sendHeaders = false;
            $this->headers = [];

            return;
        }

        $this->response = $event->getResponse();
        foreach ($this->headers as $header => $content) {
            $this->response->headers->set($header, $content);
        }
        $this->headers = [];
    }
1031071
public function onSetErrorListenerQuery(
        QueueSetErrorEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $table          = $event->getQueueTable();
        $field          = $event->getField();
        $id             = $event->getId();
        $query          = "UPDATE $table SET $field = 1 WHERE id = $id";
        $event->setQuery($query);
    }
747638
public function onResponse(FilterResponseEvent $event)
    {
        $request = $event->getRequest();
        $debug = $request->query->get('debug');
        $response = $event->getResponse();

        //this is for debug purpose
        if ($response instanceof JsonResponse && $debug) {
            $new = new Response();
            $new->setContent('<body>'.$response->getContent().'</body>');
            $event->setResponse($new);
        }
    }
162676
public function onResponse(FilterResponseEvent $event) {
    $response = $event->getResponse();

    $node = $this->getObject($response, 'node');

    if ($node === FALSE) {
      return;
    }

    $links = array_merge(
      $this->generateEntityReferenceLinks($node),
      $this->generateRelatedMediaLinks($node),
      $this->generateRestLinks($node)
    );

    // Add the link headers to the response.
    if (empty($links)) {
      return;
    }

    $response->headers->set('Link', $links, FALSE);
  }