[FEATURE] Introduce Request/Response based on PSR-7 55/40355/20
authorBenjamin Mack <benni@typo3.org>
Wed, 20 May 2015 04:28:41 +0000 (12:28 +0800)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 13 Jul 2015 12:11:02 +0000 (14:11 +0200)
commitab3729bb87010e28c1ec80a11ca1024650b2c5bb
treed64627cb181af51dfa408847b34d20a9ceaa36dd
parentccf7dae56adaae36f4c0a103f1c7b3c17af8494a
[FEATURE] Introduce Request/Response based on PSR-7

The PSR-7 standard is adapted into the TYPO3 Bootstrap with a
backwards-compatible layer.

The PSR-7 implementation brings several new classes:
 * Message (the base for Requests and Responses)
 * Request (for Requests made within PHP)
 * ServerRequest and a factory based on the current system environment
 * Response
 * Uri (a unified API for fetching several parts of an URI)

At any TYPO3 request a new ServerRequest object is created inside the
Bootstrap and handed over to the RequestHandler which can then use this
object for checking certain GET and POST variables instead of using
GeneralUtility.

The proper call (usually a Controller) creates a Response object that
is handed back to the RequestHandler + Bootstrap. The TYPO3 Bootstrap
will output anything related in the shutdown() method.

An example is shown with the LoginController and currently hard-wired
as no proper routing/dispatching is there yet.

Currently this is an internal API as the rest (Dispatch/Router and
Controller API) will follow once the base is in.

Please note that the PSR-7 standard works with Value Objects meaning
that it is not possible to modify any object but instead new objects
will be created for Message, ServerRequest and Response if modified.

The next steps are:
* Integrate proper Routing + Dispatching for Backend Routes to register
  new BE requests
* Migrate all AJAX Calls to use the new API and request / response
  handling
* Introduce a common Base Controller for all regular BE requests which
  is based on Request/Response and works as a replacement for sc_base
* Then: proper documentation for the whole bootstrap /
  dispatch + routing / controller logic
* Integrate symfony console app into the CLI Bootstrap as alternative
  for Request/Response
* Refactor TSFE to use Response / Request objects properly
* Refactor redirects logic to use Response objects

Resolves: #67558
Releases: master
Change-Id: I5b528284ecca790f784c7780b008356158343ee8
Reviewed-on: http://review.typo3.org/40355
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
30 files changed:
composer.json
typo3/index.php
typo3/sysext/backend/Classes/Console/CliRequestHandler.php
typo3/sysext/backend/Classes/Controller/LoginController.php
typo3/sysext/backend/Classes/Http/AjaxRequestHandler.php
typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php
typo3/sysext/backend/Classes/Http/RequestHandler.php
typo3/sysext/backend/Tests/Unit/BackendModuleRequestHandlerTest.php [deleted file]
typo3/sysext/backend/Tests/Unit/Http/BackendModuleRequestHandlerTest.php [new file with mode: 0644]
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/RequestHandlerInterface.php
typo3/sysext/core/Classes/Http/ControllerInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/Message.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/Request.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/Response.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/ServerRequest.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/ServerRequestFactory.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/Stream.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/UploadedFile.php [new file with mode: 0644]
typo3/sysext/core/Classes/Http/Uri.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/MessageTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/RequestTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/ResponseTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/ServerRequestFactoryTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/ServerRequestTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/StreamTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Http/UriTest.php [new file with mode: 0644]
typo3/sysext/frontend/Classes/Http/EidRequestHandler.php
typo3/sysext/frontend/Classes/Http/RequestHandler.php