public function findRequestedApplication(RequestContextInterface $requestContext)
    {

        // prepare the request URL we want to match
        $webappsDir = $this->getServerContext()->getServerConfig()->getDocumentRoot();
        $relativeRequestPath = strstr($requestContext->getServerVar(ServerVars::DOCUMENT_ROOT) . $requestContext->getServerVar(ServerVars::X_REQUEST_URI), $webappsDir);
        $proposedAppName = strstr(str_replace($webappsDir . '/', '', $relativeRequestPath), '/', true);

        // try to match a registered application with the passed request
        foreach ($this->applications as $application) {
            if ($application->getName() === $proposedAppName) {
                return $application;
            }
        }

        // if we did not find anything we should throw a bad request exception
        throw new BadRequestException(
            sprintf(
                'Can\'t find application for URL %s%s',
                $requestContext->getServerVar(ServerVars::HTTP_HOST),
                $requestContext->getServerVar(ServerVars::X_REQUEST_URI)
            ),
            404
        );
    }
public function findRequestedApplication(RequestContextInterface $requestContext)
    {

        // prepare the request URL we want to match
        $webappsDir = $this->getServerContext()->getServerConfig()->getDocumentRoot();
        $relativeRequestPath = strstr($requestContext->getServerVar(ServerVars::DOCUMENT_ROOT) . $requestContext->getServerVar(ServerVars::X_REQUEST_URI), $webappsDir);
        $proposedAppName = strstr(str_replace($webappsDir . '/', '', $relativeRequestPath), '/', true);

        // try to match a registered application with the passed request
        foreach ($this->applications as $application) {
            if ($application->getName() === $proposedAppName) {
                return $application;
            }
        }

        // if we did not find anything we should throw a bad request exception
        throw new BadRequestException(
            sprintf(
                'Can\'t find application for URL %s%s',
                $requestContext->getServerVar(ServerVars::HTTP_HOST),
                $requestContext->getServerVar(ServerVars::X_REQUEST_URI)
            ),
            404
        );
    }
public function findRequestedApplication ( RequestContextInterface $ requestContext ) { // prepare the request URL we want to match $ webappsDir = $ this -> getServerContext ( ) -> getServerConfig ( ) -> getDocumentRoot ( ) ; $ relativeRequestPath = strstr ( $ requestContext -> getServerVar ( ServerVars :: DOCUMENT_ROOT ) . $ requestContext -> getServerVar ( ServerVars :: X_REQUEST_URI ) , $ webappsDir ) ; $ proposedAppName = strstr ( str_replace ( $ webappsDir . '/' , '' , $ relativeRequestPath ) , '/' , true ) ; // try to match a registered application with the passed request foreach ( $ this -> applications as $ application ) { if ( $ application -> getName ( ) === $ proposedAppName ) { return $ application ; } } // if we did not find anything we should throw a bad request exception throw new BadRequestException ( sprintf ( 'Can\'t find application for URL %s%s' , $ requestContext -> getServerVar ( ServerVars :: HTTP_HOST ) , $ requestContext -> getServerVar ( ServerVars :: X_REQUEST_URI ) ) , 404 ) ; }
Will try to find the application based on the context path taken from the requested filename.
Will return the found application on success and throw an exception if nothing could be found

@param \AppserverIo\Server\Interfaces\RequestContextInterface $requestContext Context of the current request

@return null|\AppserverIo\Psr\Application\ApplicationInterface

@throws \AppserverIo\Appserver\ServletEngine\BadRequestException
Will try to find the application based on the context path taken from the requested filename . Will return the found application on success and throw an exception if nothing could be found