[TASK] Directly wire Application and RequestHandler
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / Http / Application.php
index 33b1def..53fcbf7 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Frontend\Http;
 
 /*
@@ -14,15 +15,25 @@ namespace TYPO3\CMS\Frontend\Http;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Core\ApplicationInterface;
 use TYPO3\CMS\Core\Core\Bootstrap;
+use TYPO3\CMS\Core\Http\AbstractApplication;
 
 /**
  * Entry point for the TYPO3 Frontend
  */
-class Application implements ApplicationInterface
+class Application extends AbstractApplication
 {
     /**
+     * @var string
+     */
+    protected $requestHandler = RequestHandler::class;
+
+    /**
+     * @var string
+     */
+    protected $middlewareStack = 'frontend';
+
+    /**
      * @var Bootstrap
      */
     protected $bootstrap;
@@ -35,14 +46,6 @@ class Application implements ApplicationInterface
     protected $entryPointLevel = 0;
 
     /**
-     * All available request handlers that can deal with a Frontend Request
-     * @var array
-     */
-    protected $availableRequestHandlers = [
-        \TYPO3\CMS\Frontend\Http\RequestHandler::class,
-    ];
-
-    /**
      * Constructor setting up legacy constant and register available Request Handlers
      *
      * @param \Composer\Autoload\ClassLoader $classLoader an instance of the class loader
@@ -61,30 +64,10 @@ class Application implements ApplicationInterface
             $this->bootstrap->redirectToInstallTool($this->entryPointLevel);
         }
 
-        foreach ($this->availableRequestHandlers as $requestHandler) {
-            $this->bootstrap->registerRequestHandlerImplementation($requestHandler);
-        }
-
         $this->bootstrap->configure();
     }
 
     /**
-     * Starting point
-     *
-     * @param callable $execute
-     */
-    public function run(callable $execute = null)
-    {
-        $this->bootstrap->handleRequest(\TYPO3\CMS\Core\Http\ServerRequestFactory::fromGlobals(), 'frontend');
-
-        if ($execute !== null) {
-            call_user_func($execute);
-        }
-
-        $this->bootstrap->shutdown();
-    }
-
-    /**
      * Define constants and variables
      */
     protected function defineLegacyConstants()