AppserverIo\Appserver\ServletEngine\ServletManager::locate PHP Метод

locate() публичный Метод

Tries to locate the resource related with the request.
См. также: AppserverIo\Appserver\ServletEngine\ResourceLocator::locate()
public locate ( AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, array $args = [] ) : AppserverIo\Psr\Servlet\ServletInterface
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The request instance to return the servlet for
$args array The arguments passed to the servlet constructor
Результат AppserverIo\Psr\Servlet\ServletInterface The requested servlet
    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);
    }