title: How to render a template inside an EventListener?
body: <p>How can I render a template inside an EventListener in Symfony 2?</p>
  
  <pre><code>class RequestListener
  {
      public function __construct() { }
  
      public function onKernelRequest(GetResponseEvent $event)
      {
          $request  = $event-&gt;getRequest();
  
          // Here I want to render a particular twig template
          $response = new Response('Forbidden', 401);
  
          // replacing the response...
          $event-&gt;setResponse($response);
      }
  }
  </code></pre>
  
  <p>Could you help me with that?</p>