eZPublishCommunityProject  2013.4
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener Class Reference

This class listens, as a service, for the kernel.view event, triggered when a controller method didn't return a Response object. More...

+ Inheritance diagram for eZ\Bundle\EzPublishRestBundle\EventListener\RestListener:
+ Collaboration diagram for eZ\Bundle\EzPublishRestBundle\EventListener\RestListener:

Public Member Functions

 __construct (ContainerInterface $container, RESTRequest $request, CsrfProviderInterface $csrfProvider=null)
 
 onKernelExceptionView (GetResponseForExceptionEvent $event)
 
 onKernelRequest (GetResponseEvent $event)
 This method validates CSRF token if CSRF protection is enabled. More...
 
 onKernelResultView (GetResponseForControllerResultEvent $event)
 

Static Public Member Functions

static getSubscribedEvents ()
 

Public Attributes

const CSRF_TOKEN_HEADER = "X-CSRF-Token"
 Name of the HTTP header containing CSRF token. More...
 

Protected Member Functions

 isRestRequest (Request $request)
 
 visitResult ($result)
 

Private Attributes

 $container
 
 $csrfProvider
 
 $request
 

Detailed Description

This class listens, as a service, for the kernel.view event, triggered when a controller method didn't return a Response object.

It converts the RestValue / Value Object to a Response using Visitors

Constructor & Destructor Documentation

eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::__construct ( ContainerInterface  $container,
RESTRequest  $request,
CsrfProviderInterface  $csrfProvider = null 
)
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$container
\eZ\Publish\Core\REST\Server\Request$request
\Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface$csrfProvider

Member Function Documentation

static eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::getSubscribedEvents ( )
static
Returns
array
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::isRestRequest ( Request  $request)
protected
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::onKernelExceptionView ( GetResponseForExceptionEvent  $event)
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent$event
Exceptions
\Exception
Returns
void
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::onKernelRequest ( GetResponseEvent  $event)

This method validates CSRF token if CSRF protection is enabled.

Parameters
\Symfony\Component\HttpKernel\Event\GetResponseEvent$event
Exceptions
\eZ\Publish\Core\Base\Exceptions\UnauthorizedException
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::onKernelResultView ( GetResponseForControllerResultEvent  $event)
Parameters
\Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent$event
Exceptions
\Exception
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::visitResult (   $result)
protected

Member Data Documentation

eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::$container
private
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::$csrfProvider
private
eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::$request
private
const eZ\Bundle\EzPublishRestBundle\EventListener\RestListener::CSRF_TOKEN_HEADER = "X-CSRF-Token"

Name of the HTTP header containing CSRF token.


The documentation for this class was generated from the following file: