Commit 15ef75bc authored by Benni Mack's avatar Benni Mack Committed by Andreas Fernandez
Browse files

[FEATURE] Add Dispatcher for Backend Routing

The newly introduced Backend Routing is updated so that Routes
must define not just the controller but also the action which should
be called. It is now also possible to use a Closure / callable directly
to be called as a Route.

The RequestHandler now creates the Response object, which is
handed to the Dispatcher and to the respective action. This way
each action can already use the existing Response object.

The Dispatcher resolves the action and hands over the request and
response object.

All existing routes have been adapted to use controller and actions.

The fixed ControllerInterface is not needed anymore.

Resolves: #69855
Releases: master
Change-Id: I6edcf8e0f6b49580052f24ca9fd7ad352b6d6f34
Reviewed-on: http://review.typo3.org/43337


Reviewed-by: Nicole Cordes's avatarNicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes's avatarNicole Cordes <typo3@cordes.co>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
parent ac07d82d
......@@ -14,12 +14,12 @@ namespace TYPO3\CMS\Backend\Controller;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Domain\Repository\Module\BackendModuleRepository;
use TYPO3\CMS\Backend\Module\ModuleLoader;
use TYPO3\CMS\Backend\Toolbar\ToolbarItemInterface;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -30,7 +30,7 @@ use TYPO3\CMS\Rsaauth\RsaEncryptionEncoder;
/**
* Class for rendering the TYPO3 backend
*/
class BackendController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class BackendController {
/**
* @var string
......@@ -245,15 +245,13 @@ class BackendController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the render() method, it is rather simple for now
* This will be split up in an abstract controller once proper routing/dispatcher is in place.
*
* @param ServerRequestInterface $request
* @return \Psr\Http\Message\ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->render();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
......@@ -31,7 +30,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
/**
* Script Class for grid wizard
*/
class BackendLayoutWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class BackendLayoutWizardController {
// GET vars:
// Wizard parameters, coming from TCEforms linking to the wizard.
......@@ -211,13 +210,11 @@ class BackendLayoutWizardController implements \TYPO3\CMS\Core\Http\ControllerIn
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ResponseInterface $response
* @return ResponseInterface
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->doc->render('Grid wizard', $this->content));
return $response;
}
......@@ -271,7 +268,7 @@ class BackendLayoutWizardController implements \TYPO3\CMS\Core\Http\ControllerIn
* Returns the sourcecode to the browser
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -25,7 +24,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
* Script Class for showing the history module of TYPO3s backend
* @see \TYPO3\CMS\Backend\History\RecordHistory
*/
class ElementHistoryController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class ElementHistoryController {
/**
* @var string
......@@ -58,17 +57,16 @@ class ElementHistoryController implements \TYPO3\CMS\Core\Http\ControllerInterfa
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -109,7 +107,7 @@ class ElementHistoryController implements \TYPO3\CMS\Core\Http\ControllerInterfa
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -30,7 +29,7 @@ use TYPO3\CMS\Backend\Backend\Avatar\Avatar;
/**
* Script Class for showing information about an item.
*/
class ElementInformationController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class ElementInformationController {
/**
* Record table name
......@@ -194,18 +193,17 @@ class ElementInformationController implements \TYPO3\CMS\Core\Http\ControllerInt
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
$content = $this->doc->startPage($this->titleTag);
$content .= $this->doc->insertStylesAndJS($this->content);
$content .= $this->doc->endPage();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($content);
return $response;
}
......@@ -540,7 +538,7 @@ class ElementInformationController implements \TYPO3\CMS\Core\Http\ControllerInt
* End page and print content
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -26,7 +25,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script Class for rendering the move-element wizard display
*/
class MoveElementController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class MoveElementController {
/**
* @var int
......@@ -128,14 +127,13 @@ class MoveElementController implements \TYPO3\CMS\Core\Http\ControllerInterface
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -255,7 +253,7 @@ class MoveElementController implements \TYPO3\CMS\Core\Http\ControllerInterface
* Print out the accumulated content:
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -16,7 +16,6 @@ namespace TYPO3\CMS\Backend\Controller\ContentElement;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\Imaging\Icon;
......@@ -27,7 +26,7 @@ use TYPO3\CMS\Core\Utility\PathUtility;
/**
* Script Class for the New Content element wizard
*/
class NewContentElementController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class NewContentElementController {
/**
* Page id
......@@ -165,14 +164,13 @@ class NewContentElementController implements \TYPO3\CMS\Core\Http\ControllerInte
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -324,7 +322,7 @@ class NewContentElementController implements \TYPO3\CMS\Core\Http\ControllerInte
* Print out the accumulated content:
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -16,13 +16,12 @@ namespace TYPO3\CMS\Backend\Controller;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script Class, creating the content for the dummy script - which is just blank output.
*/
class DummyController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class DummyController {
/**
* @var string
......@@ -40,14 +39,13 @@ class DummyController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -68,7 +66,7 @@ class DummyController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use mainAction() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -14,14 +14,13 @@ namespace TYPO3\CMS\Backend\Controller;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Form\Exception\AccessDeniedException;
use TYPO3\CMS\Backend\Form\FormResultCompiler;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
use TYPO3\CMS\Core\DataHandling\DataHandler;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -41,7 +40,7 @@ use TYPO3\CMS\Backend\Form\FormDataGroup\TcaDatabaseRecord;
* Script Class: Drawing the editing form for editing records in TYPO3.
* Notice: It does NOT use tce_db.php to submit data to, rather it handles submissions itself
*/
class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class EditDocumentController {
/**
* GPvar "edit": Is an array looking approx like [tablename][list-of-ids]=command, eg.
......@@ -1610,11 +1609,11 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
/**
* Injects the request object for the current request or subrequest
*
* @param ServerRequestInterface $request
* @return \Psr\Http\Message\ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
BackendUtility::lockRecords();
// Preprocessing, storing data if submitted to
......@@ -1628,8 +1627,6 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
$this->init();
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......
......@@ -16,8 +16,6 @@ namespace TYPO3\CMS\Backend\Controller\File;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Http\ControllerInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderAccessPermissionsException;
......@@ -31,7 +29,7 @@ use TYPO3\CMS\Core\Utility\MathUtility;
/**
* Script Class for the create-new script; Displays a form for creating up to 10 folders or one new text file
*/
class CreateFolderController implements ControllerInterface {
class CreateFolderController {
/**
* @var int
......@@ -304,13 +302,13 @@ class CreateFolderController implements ControllerInterface {
/**
* Processes the request, currently everything is handled and put together via "main()"
*
* @param ServerRequestInterface $request The request object
* @return ResponseInterface $response The response, created by the controller
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -319,7 +317,7 @@ class CreateFolderController implements ControllerInterface {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the processRequest() method instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the mainAction() method instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -20,12 +20,11 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\Response;
/**
* Script Class for rendering the file editing screen
*/
class EditFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class EditFileController {
/**
* Module content accumulated.
......@@ -214,13 +213,13 @@ class EditFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Processes the request, currently everything is handled and put together via "main()"
*
* @param ServerRequestInterface $request The request object
* @return ResponseInterface $response The response, created by the controller
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -229,7 +228,7 @@ class EditFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the processRequest() method instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the mainAction() method instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -14,9 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\File;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\AjaxRequestHandler;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Core\Resource\DuplicationBehavior;
use TYPO3\CMS\Core\Resource\Folder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -30,7 +30,7 @@ use TYPO3\CMS\Core\Utility\File\ExtendedFileUtility;
* Before TYPO3 4.3, it was located in typo3/tce_file.php and redirected back to a
* $redirectURL. Since 4.3 this class is also used for accessing via AJAX
*/
class FileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class FileController {
/**
* Array of file-operations.
......@@ -169,18 +169,17 @@ class FileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it just redirects to the given URL afterwards.
*
* @param ServerRequestInterface $request
* @return \Psr\Http\Message\ResponseInterface $response
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
// Push errors to flash message queue, if there are any
$this->fileProcessor->pushErrorMessagesToFlashMessageQueue();
BackendUtility::setUpdateSignal('updateFolderTree');
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
if ($this->redirect) {
$response = $response->withHeader('Location', GeneralUtility::locationHeaderUrl($this->redirect));
return $response->withStatus(303);
......
......@@ -20,12 +20,11 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\Response;
/**
* Script Class for display up to 10 upload fields
*/
class FileUploadController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class FileUploadController {
/**
* Document template object
......@@ -186,13 +185,13 @@ class FileUploadController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Processes the request, currently everything is handled and put together via "main()"
*
* @param ServerRequestInterface $request The request object
* @return ResponseInterface $response The response, created by the controller
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -201,7 +200,7 @@ class FileUploadController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the processRequest() method instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the mainAction() method instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -20,12 +20,11 @@ use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\Response;
/**
* Script Class for the rename-file form.
*/
class RenameFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class RenameFileController {
/**
* Document template object
......@@ -184,13 +183,13 @@ class RenameFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Processes the request, currently everything is handled and put together via "main()"
*
* @param ServerRequestInterface $request The request object
* @return ResponseInterface $response The response, created by the controller
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function processRequest(ServerRequestInterface $request) {
public function mainAction(ServerRequestInterface $request, ResponseInterface $response) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
......@@ -199,7 +198,7 @@ class RenameFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the processRequest() method instead
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use the mainAction() method instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
......
......@@ -25,12 +25,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Lang\LanguageService;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Http\Response;
/**
* Script Class for the rename-file form
*/
class ReplaceFileController implements \TYPO3\CMS\Core\Http\ControllerInterface {
class ReplaceFileController {
/**
* Document template object
......@@ -210,13 +209,13 @@ class ReplaceFileController implements \TYPO3\CMS\Core\Http\ControllerInterface