Commit f429aa86 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Andreas Fernandez
Browse files

[TASK] Remove AbstractRequestHandler

The AbstractRequestHandler was an abstract class
which didn't add any helper method at all, concrete
implementations did benefit from.

In fact, it even implemented a contract method, which
should notbe done by an abstract class but only by
specific implementations.

Besides that, only DI methods had been shared which
also just hides the dependencies of the specific
implementations.

Releases: master
Resolves: #93157
Change-Id: Ib054f9435e7fa3937e5250bfce62b210c1cbb4e9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67219


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benjamin Franzke's avatarBenjamin Franzke <bfr@qbus.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 68208344
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Extbase\Mvc\Web;
use TYPO3\CMS\Extbase\Mvc\Dispatcher;
use TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface;
use TYPO3\CMS\Extbase\Object\ObjectManagerInterface;
use TYPO3\CMS\Extbase\Service\EnvironmentService;
/**
* A request handler which can handle web requests.
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
abstract class AbstractRequestHandler implements RequestHandlerInterface
{
/**
* @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
*/
protected $objectManager;
/**
* @var \TYPO3\CMS\Extbase\Mvc\Dispatcher
*/
protected $dispatcher;
/**
* @var \TYPO3\CMS\Extbase\Service\EnvironmentService
*/
protected $environmentService;
/**
* @param \TYPO3\CMS\Extbase\Mvc\Dispatcher $dispatcher
*/
public function injectDispatcher(Dispatcher $dispatcher)
{
$this->dispatcher = $dispatcher;
}
/**
* @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
*/
public function injectObjectManager(ObjectManagerInterface $objectManager)
{
$this->objectManager = $objectManager;
}
/**
* @param \TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService
*/
public function injectEnvironmentService(EnvironmentService $environmentService)
{
$this->environmentService = $environmentService;
}
/**
* Returns the priority - how eager the handler is to actually handle the
* request.
*
* @return int The priority of the request handler.
*/
public function getPriority()
{
return 100;
}
}
......@@ -15,17 +15,31 @@
namespace TYPO3\CMS\Extbase\Mvc\Web;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Extbase\Mvc\Dispatcher;
use TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException;
use TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
use TYPO3\CMS\Extbase\Mvc\ResponseInterface;
use TYPO3\CMS\Extbase\Service\EnvironmentService;
/**
* A request handler which can handle web requests invoked by the backend.
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
class BackendRequestHandler extends AbstractRequestHandler
class BackendRequestHandler implements RequestHandlerInterface
{
protected Dispatcher $dispatcher;
protected EnvironmentService $environmentService;
public function __construct(
Dispatcher $dispatcher,
EnvironmentService $environmentService
) {
$this->dispatcher = $dispatcher;
$this->environmentService = $environmentService;
}
/**
* Handles the web request. The response will automatically be sent to the client.
*
......@@ -48,4 +62,9 @@ class BackendRequestHandler extends AbstractRequestHandler
{
return $this->environmentService->isEnvironmentInBackendMode() && !Environment::isCli();
}
public function getPriority(): int
{
return 100;
}
}
......@@ -17,26 +17,30 @@ namespace TYPO3\CMS\Extbase\Mvc\Web;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Mvc\Dispatcher;
use TYPO3\CMS\Extbase\Mvc\Exception\InfiniteLoopException;
use TYPO3\CMS\Extbase\Mvc\RequestHandlerInterface;
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
use TYPO3\CMS\Extbase\Service\EnvironmentService;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* A request handler which can handle web requests invoked by the frontend.
* @internal only to be used within Extbase, not part of TYPO3 Core API.
*/
class FrontendRequestHandler extends AbstractRequestHandler
class FrontendRequestHandler implements RequestHandlerInterface
{
/**
* @var ConfigurationManagerInterface
*/
protected $configurationManager;
protected Dispatcher $dispatcher;
protected EnvironmentService $environmentService;
protected ConfigurationManagerInterface $configurationManager;
/**
* @param ConfigurationManagerInterface $configurationManager
*/
public function injectConfigurationManager(ConfigurationManagerInterface $configurationManager)
{
public function __construct(
Dispatcher $dispatcher,
EnvironmentService $environmentService,
ConfigurationManagerInterface $configurationManager
) {
$this->dispatcher = $dispatcher;
$this->environmentService = $environmentService;
$this->configurationManager = $configurationManager;
}
......@@ -89,4 +93,9 @@ class FrontendRequestHandler extends AbstractRequestHandler
return !in_array($actionName, $frameworkConfiguration['controllerConfiguration'][$controllerClassName]['nonCacheableActions'], true);
}
public function getPriority(): int
{
return 100;
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment