]> git.mxchange.org Git - shipsimu.git/blobdiff - inc/classes/main/controller/default/class_WebDefaultController.php
Actions (so called sub-commands) may now have own pre/post filter, profile update...
[shipsimu.git] / inc / classes / main / controller / default / class_WebDefaultController.php
index 3256f461d8b928d988b5914375a49e7f85f35e55..7f7e862f8ae24b1e28dcb8f7cf7d6b6bdb3489b6 100644 (file)
@@ -7,6 +7,7 @@
  * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
+ * @todo               This controller shall still provide some headlines for sidebars
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class WebWebDefaultController extends BaseController implements Controller {
+class WebDefaultController extends BaseController implements Controller {
        /**
-        * Instance of a CommandResolver class
-        */
-       private $resolverInstance = null;
-
-       /**
-        * Private constructor
+        * Protected constructor
         *
         * @return      void
         */
@@ -37,13 +33,10 @@ class WebWebDefaultController extends BaseController implements Controller {
                parent::__construct(__CLASS__);
 
                // Set part description
-               $this->setObjectDescription("Standart-Controller f&uuml;r alle &uuml;brigen Anfragen");
+               $this->setObjectDescription("Default controller for all other requests");
 
                // Create unique ID number
-               $this->createUniqueID();
-
-               // Clean up a little
-               $this->removeSystemArray();
+               $this->generateUniqueId();
        }
 
        /**
@@ -63,16 +56,6 @@ class WebWebDefaultController extends BaseController implements Controller {
                return $controllerInstance;
        }
 
-       /**
-        * Setter for a command resolver instance
-        *
-        * @param       $resolverInstance       An instance of a command resolver class
-        * @return      void
-        */
-       public final function setResolverInstance (CommandResolver $resolverInstance) {
-               $this->resolverInstance = $resolverInstance;
-       }
-
        /**
         * Handles the given request and response
         *
@@ -82,13 +65,16 @@ class WebWebDefaultController extends BaseController implements Controller {
         */
        public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
                // Get the command instance
-               $commandInstance = $this->resolverInstance->resolvCommandByRequest($requestInstance);
+               $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+               // This request was valid! :-D
+               $requestInstance->requestIsValid();
 
                // Execute the command
                $commandInstance->execute($requestInstance, $responseInstance);
 
                // Flush the response out
-               $responseInstance->flushResponse();
+               $responseInstance->flushBuffer();
        }
 }