| @@ 60-77 (lines=18) @@ | ||
| 57 | * @return null|\AppserverIo\Psr\Application\ApplicationInterface |
|
| 58 | * @throws \AppserverIo\Appserver\ServletEngine\BadRequestException Is thrown if no application is available |
|
| 59 | */ |
|
| 60 | protected function findRequestedApplication(RequestContextInterface $requestContext) |
|
| 61 | { |
|
| 62 | ||
| 63 | // return the first application (we only have one) |
|
| 64 | foreach ($this->applications as $application) { |
|
| 65 | return $application; |
|
| 66 | } |
|
| 67 | ||
| 68 | // if we did not find anything we should throw a bad request exception |
|
| 69 | throw new BadRequestException( |
|
| 70 | sprintf( |
|
| 71 | 'Can\'t find application for URL %s%s', |
|
| 72 | $requestContext->getServerVar(ServerVars::HTTP_HOST), |
|
| 73 | $requestContext->getServerVar(ServerVars::X_REQUEST_URI) |
|
| 74 | ), |
|
| 75 | 404 |
|
| 76 | ); |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Process servlet request. |
|
| @@ 49-66 (lines=18) @@ | ||
| 46 | * @return null|\AppserverIo\Psr\Application\ApplicationInterface |
|
| 47 | * @throws \AppserverIo\Appserver\ServletEngine\BadRequestException Is thrown if no application is available |
|
| 48 | */ |
|
| 49 | protected function findRequestedApplication(RequestContextInterface $requestContext) |
|
| 50 | { |
|
| 51 | ||
| 52 | // return the first application (we only have one) |
|
| 53 | foreach ($this->applications as $application) { |
|
| 54 | return $application; |
|
| 55 | } |
|
| 56 | ||
| 57 | // if we did not find anything we should throw a bad request exception |
|
| 58 | throw new BadRequestException( |
|
| 59 | sprintf( |
|
| 60 | 'Can\'t find application for URL %s%s', |
|
| 61 | $requestContext->getServerVar(ServerVars::HTTP_HOST), |
|
| 62 | $requestContext->getServerVar(ServerVars::X_REQUEST_URI) |
|
| 63 | ), |
|
| 64 | 404 |
|
| 65 | ); |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||