/** * Tries to locate the resource related with the request. * * @param \AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest The request instance to return the servlet for * @param array $args The arguments passed to the servlet constructor * * @return \AppserverIo\Psr\Servlet\ServletInterface The requested servlet * @see \AppserverIo\Appserver\ServletEngine\ResourceLocator::locate() */ public function locate(HttpServletRequestInterface $servletRequest, array $args = array()) { // load the servlet path => to locate the servlet $servletPath = $servletRequest->getServletPath(); // check if we've a HTTP session-ID $sessionId = null; // if no session has already been load, initialize the session manager if ($manager = $this->getApplication()->search('SessionManagerInterface')) { $requestedSessionName = $manager->getSessionSettings()->getSessionName(); if ($servletRequest->hasCookie($requestedSessionName)) { $sessionId = $servletRequest->getCookie($requestedSessionName)->getValue(); } } // return the instance return $this->lookup($servletPath, $sessionId, $args); }