[TASK] Ensure HTTP RequestHandlers always return a PSR-7 Repsonse
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Http / RequestHandlerInterface.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Core\Http;
4
5 /*
6 * This file is part of the TYPO3 CMS project.
7 *
8 * It is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, either version 2
10 * of the License, or any later version.
11 *
12 * For the full copyright and license information, please read the
13 * LICENSE.txt file that was distributed with this source code.
14 *
15 * The TYPO3 project - inspiring people to share!
16 */
17
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20
21 /**
22 * The interface for a request handler
23 * see RequestHandler in EXT:backend/Classes/Http/ and EXT:frontend/Classes/Http
24 *
25 * @api
26 */
27 interface RequestHandlerInterface
28 {
29 /**
30 * Handles a raw request
31 *
32 * @param ServerRequestInterface $request
33 * @return ResponseInterface
34 * @api
35 */
36 public function handleRequest(ServerRequestInterface $request);
37
38 /**
39 * Checks if the request handler can handle the given request.
40 *
41 * @param ServerRequestInterface $request
42 * @return bool TRUE if it can handle the request, otherwise FALSE
43 * @api
44 */
45 public function canHandleRequest(ServerRequestInterface $request);
46
47 /**
48 * Returns the priority - how eager the handler is to actually handle the
49 * request. An integer > 0 means "I want to handle this request" where
50 * "100" is default. "0" means "I am a fallback solution".
51 *
52 * @return int The priority of the request handler
53 * @api
54 */
55 public function getPriority();
56 }