* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Sets the session in the request. * * @author Johannes M. Schmitt */ abstract class AbstractSessionListener implements EventSubscriberInterface { public function onKernelRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $request = $event->getRequest(); $session = $this->getSession(); if (null === $session || $request->hasSession()) { return; } $request->setSession($session); } public function onKernelResponse(FilterResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!$session = $event->getRequest()->getSession()) { return; } if ($session->isStarted() || ($session instanceof Session && $session->hasBeenStarted())) { $event->getResponse() ->setPrivate() ->setMaxAge(0) ->headers->addCacheControlDirective('must-revalidate'); } } public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 128), // low priority to come after regular response listeners, same as SaveSessionListener KernelEvents::RESPONSE => array('onKernelResponse', -1000), ); } /** * Gets the session object. * * @return SessionInterface|null A SessionInterface instance or null if no session is available */ abstract protected function getSession(); } __halt_compiler();----SIGNATURE:----Z5McCu80htH7UpG4pTE7BXkjZSqvMHSdjreBMBeG4S/DGDcRPCID4JAFcsr/c2DF0si8jgOBarPLGpx+mXUp1Q8KLP7j2hdTpfJY4hJ9NN6JGAjwyDAK61HLnecJqBW2Mjqvrby1CFAmekXmu+WqbkA3JuGPlt1L2OKh7ogIy7ApV1FoO4Fjz/rYALfNQkSoj07Aqq3etx1ElD+tBWZ+PfUSTOIc329B6UpqdJ22mpvt9GFMvPQAh/cyGEEFs0vcbL1avmnIlGdf+Ihx8w0EG1oZk1WmLeFEfJQXG2OZhUegX4CtLQIWYalRW/H8fZorivXN3OfhosjBa0zPNg2rsVMV6BLaUFvNLqXJypKnvL8q0On79BkGy5qiA+uY+utsmMD+bV93Ke1lUI+rzO9OXOXj5Vse3Ar/Y24c9WaIUbPkMsOOBkRV3enCCN4SiBH50sajpEYyp8/IZXynT0kEh6fT0ldShyCdLY+tMPcDdLQJeZmMsJQQTSMG9ZajBHN+H+mVeFbZ1oZTBjyw37xL4egWssqtLta+IaIyJq+lu2JRnSsScMic8GDgBM5QUmGinB9K90hQvjj54thP32DjANtsuT9mUADon8VgStYy0iprgAj7gF7K0L/wd59FpSP9esq55uHO0/qCMqgrS3Tm9DN+cI9s7OfIE+4ErP7Sans=----ATTACHMENT:----MzY3MDQxOTE1NTMwOTE4MiAxOTU5OTEzMjI1Nzc0Njc0IDg5NjcwNzg2MzMxNDk0MzM=