* implemented support for additional header data
[Packages/TYPO3.CMS.git] / typo3 / sysext / extbase / Classes / Web / TX_EXTMVC_Web_Request.php
index 214bf4d..d6f670a 100755 (executable)
@@ -1,7 +1,6 @@
 <?php
 declare(ENCODING = 'utf-8');
 
-
 /*                                                                        *
  * This script belongs to the FLOW3 framework.                            *
  *                                                                        *
@@ -22,23 +21,15 @@ declare(ENCODING = 'utf-8');
  * The TYPO3 project - inspiring people to share!                         *
  *                                                                        */
 
-/**
- * @package FLOW3
- * @subpackage MVC
- * @version $Id:$
- */
-
 /**
  * Represents a web request.
  *
- * @package FLOW3
- * @subpackage MVC
  * @version $Id:$
  * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
  *
  * @scope prototype
  */
-class Request extends TX_EXTMVC_Request {
+class TX_EXTMVC_Web_Request extends TX_EXTMVC_Request {
 
        /**
         * @var string The requested representation format
@@ -48,7 +39,7 @@ class Request extends TX_EXTMVC_Request {
        /**
         * @var string Contains the request method
         */
-       protected $method = F3_FLOW3_Utility_Environment::REQUEST_METHOD_GET;
+       protected $method = 'GET';
 
        /**
         * @var F3_FLOW3_Utility_Environment
@@ -65,35 +56,16 @@ class Request extends TX_EXTMVC_Request {
         */
        protected $baseURI;
 
-       /**
-        * Injects the environment
-        *
-        * @param F3_FLOW3_Utility_Environment $environment
-        * @return void
-        * @author Robert Lemke <robert@typo3.org>
-        */
-       public function injectEnvironment(F3_FLOW3_Utility_Environment $environment) {
-               $this->environment = $environment;
-       }
-
        /**
         * Sets the request method
         *
-        * @param string $method Name of the request method - one of the F3_FLOW3_Utility_Environment::REQUEST_METHOD_* constants
+        * @param string $method Name of the request method
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         * @throws TX_EXTMVC_Exception_InvalidRequestMethod if the request method is not supported
         */
        public function setMethod($method) {
-               if (array_search($method, array(
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_GET,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_POST,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_DELETE,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_PUT,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_HEAD,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_OPTIONS,
-                               F3_FLOW3_Utility_Environment::REQUEST_METHOD_UNKNOWN
-                       )) === FALSE) throw new TX_EXTMVC_Exception_InvalidRequestMethod('The request method "' . $method . '" is not supported.', 1217778382);
+               if ($method === '' || (strtoupper($method) !== $method)) throw new TX_EXTMVC_Exception_InvalidRequestMethod('The request method "' . $method . '" is not supported.', 1217778382);
                $this->method = $method;
        }
 
@@ -110,11 +82,11 @@ class Request extends TX_EXTMVC_Request {
        /**
         * Sets the request URI
         *
-        * @param F3_FLOW3_Property_DataType_URI $requestURI URI of this web request
+        * @param string $requestURI URI of this web request
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function setRequestURI(F3_FLOW3_Property_DataType_URI $requestURI) {
+       public function setRequestURI($requestURI) {
                $this->requestURI = clone $requestURI;
                $this->baseURI = $this->detectBaseURI($requestURI);
        }
@@ -132,11 +104,11 @@ class Request extends TX_EXTMVC_Request {
        /**
         * Sets the base URI for this request.
         *
-        * @param F3_FLOW3_Property_DataType_URI $baseURI New base URI
+        * @param string $baseURI New base URI
         * @return void
         * @author Robert Lemke <robert@typo3.org>
         */
-       public function setBaseURI(F3_FLOW3_Property_DataType_URI $baseURI) {
+       public function setBaseURI($baseURI) {
                $this->baseURI = clone $baseURI;
        }
 
@@ -153,11 +125,11 @@ class Request extends TX_EXTMVC_Request {
        /**
         * Tries to detect the base URI of this request and returns it.
         *
-        * @param F3_FLOW3_Property_DataType_URI $requestURI URI of this web request
-        * @return F3_FLOW3_Property_DataType_URI The detected base URI
+        * @param string $requestURI URI of this web request
+        * @return string The detected base URI
         * @author Robert Lemke <robert@typo3.org>
         */
-       protected function detectBaseURI(F3_FLOW3_Property_DataType_URI $requestURI) {
+       protected function detectBaseURI($requestURI) {
                $baseURI = clone $requestURI;
                $baseURI->setQuery(NULL);
                $baseURI->setFragment(NULL);