|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the TYPO3 CMS project. |
|
5
|
|
|
* |
|
6
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
7
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
8
|
|
|
* of the License, or any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* For the full copyright and license information, please read the |
|
11
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
12
|
|
|
* |
|
13
|
|
|
* The TYPO3 project - inspiring people to share! |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace TYPO3\CMS\Extbase\Mvc\Web; |
|
17
|
|
|
|
|
18
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
19
|
|
|
use TYPO3\CMS\Extbase\Mvc\Dispatcher; |
|
20
|
|
|
use TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException; |
|
21
|
|
|
use TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface; |
|
22
|
|
|
use TYPO3\CMS\Extbase\Mvc\RequestInterface; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* A request handler which can handle web requests. |
|
26
|
|
|
* @internal only to be used within Extbase, not part of TYPO3 Core API. |
|
27
|
|
|
*/ |
|
28
|
|
|
class FrontendRequestHandler implements RequestHandlerInterface |
|
29
|
|
|
{ |
|
30
|
|
|
protected Dispatcher $dispatcher; |
|
31
|
|
|
|
|
32
|
|
|
public function __construct(Dispatcher $dispatcher) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->dispatcher = $dispatcher; |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* Handles the web request. The response will automatically be sent to the client. |
|
39
|
|
|
* |
|
40
|
|
|
* @param RequestInterface $request |
|
41
|
|
|
* @return ResponseInterface |
|
42
|
|
|
* @throws InfiniteLoopException |
|
43
|
|
|
*/ |
|
44
|
|
|
public function handleRequest(RequestInterface $request) |
|
45
|
|
|
{ |
|
46
|
|
|
return $this->dispatcher->dispatch($request); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* This request handler can handle any web request. |
|
51
|
|
|
* |
|
52
|
|
|
* @param RequestInterface $request |
|
53
|
|
|
* @return bool If the request is a web request, TRUE otherwise FALSE |
|
54
|
|
|
*/ |
|
55
|
|
|
public function canHandleRequest(RequestInterface $request) |
|
56
|
|
|
{ |
|
57
|
|
|
return true; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function getPriority(): int |
|
61
|
|
|
{ |
|
62
|
|
|
return 100; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|