* * 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:----cQ8hD7EHQU4nhHd5bN3vZm5CzmZ1sZFcvrDDE+RX5otpSfV6lw3ZJV0MS4BO4Nqm9XyKAKatjxOUfaQ9ukiB1kz18BGG3DdmVKK1+WAFczUnRgdsHu/HY25xp5E2z8TySIV4Bpx4O08fiFT5F/o1pt5weG9SIqjM6JZdwfD7ddSQqxNGo9UjmfpUzmzhb7rEgWWczEILbKRgDr/V4XAjw8yMs+EIj1wRpYGy+qhtMF80YGikiHOGJSy130IndFaR90V2xSc4Ccs409s50/atoHPRTQWlEVBVzz2vRG2tPSW/D1J7YytPK4NWNgGgAOS2/fLBVHZpBslw/CK2tKDPPLonU+XfKFGeo15DZGrxk5zH2hreRDtbLL1ocXlfU+NSWwPyqHozvCqITVV2PXrgOkrCAEc8DRsvddAn0LVU4Rb2N8HDuqGd7tlYehJDIFxX3R/bBnZKbXl+z8HckPGch4X1/1TLG73PjLiaVOOiNwQ/ztjXmPysWCpyTQn1Y23bqmm8P94tMGS4a6AaILBC2hgYUZgYxhebvjcRWnRgU5Wlzt9BmkTdh58TVbIyZWybxFKvIWGwV9/ebp1CCU3DARH7kfPTbjV9/eds9YQhC8GKyOdMynhzGJ5uctB4wBkrBa8tU7dUte7IFn7X0+4sb8GUfsidgFahQfKLl3UksYk=----ATTACHMENT:----MzM2MjkwNDU3NDQwMTI5MyA4OTEyMjA0MjkzNDA0ODI2IDI4ODQ1NzI3MDAwOTc5