]> source.dussan.org Git - nextcloud-server.git/commitdiff
make download and redirectresponse public
authorBernhard Posselt <dev@bernhard-posselt.com>
Sun, 20 Apr 2014 14:12:46 +0000 (16:12 +0200)
committerBernhard Posselt <dev@bernhard-posselt.com>
Sun, 20 Apr 2014 14:12:46 +0000 (16:12 +0200)
lib/private/appframework/http/downloadresponse.php [deleted file]
lib/private/appframework/http/redirectresponse.php [deleted file]
lib/private/appframework/middleware/security/securitymiddleware.php
lib/public/appframework/http/downloadresponse.php [new file with mode: 0644]
lib/public/appframework/http/redirectresponse.php [new file with mode: 0644]
tests/lib/appframework/http/DownloadResponseTest.php
tests/lib/appframework/http/RedirectResponseTest.php
tests/lib/appframework/middleware/security/SecurityMiddlewareTest.php

diff --git a/lib/private/appframework/http/downloadresponse.php b/lib/private/appframework/http/downloadresponse.php
deleted file mode 100644 (file)
index 67b9542..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-
-/**
- * ownCloud - App Framework
- *
- * @author Bernhard Posselt
- * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
-namespace OC\AppFramework\Http;
-
-
-/**
- * Prompts the user to download the a file
- */
-class DownloadResponse extends \OCP\AppFramework\Http\Response {
-
-       private $filename;
-       private $contentType;
-
-       /**
-        * Creates a response that prompts the user to download the file
-        * @param string $filename the name that the downloaded file should have
-        * @param string $contentType the mimetype that the downloaded file should have
-        */
-       public function __construct($filename, $contentType) {
-               $this->filename = $filename;
-               $this->contentType = $contentType;
-
-               $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"');
-               $this->addHeader('Content-Type', $contentType);
-       }
-
-
-}
diff --git a/lib/private/appframework/http/redirectresponse.php b/lib/private/appframework/http/redirectresponse.php
deleted file mode 100644 (file)
index 0535334..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-/**
- * ownCloud - App Framework
- *
- * @author Bernhard Posselt
- * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
- *
- * You should have received a copy of the GNU Affero General Public
- * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
-namespace OC\AppFramework\Http;
-
-use OCP\AppFramework\Http\Response;
-use OCP\AppFramework\Http;
-
-
-/**
- * Redirects to a different URL
- */
-class RedirectResponse extends Response {
-
-       private $redirectURL;
-
-       /**
-        * Creates a response that redirects to a url
-        * @param string $redirectURL the url to redirect to
-        */
-       public function __construct($redirectURL) {
-               $this->redirectURL = $redirectURL;
-               $this->setStatus(Http::STATUS_TEMPORARY_REDIRECT);
-               $this->addHeader('Location', $redirectURL);
-       }
-
-
-       /**
-        * @return string the url to redirect
-        */
-       public function getRedirectURL() {
-               return $this->redirectURL;
-       }
-
-
-}
index bb02d565fa46392bf6f547358d15c920f7e31241..0f160d224ad4303fbef748ef6e8480cebd8bdc9f 100644 (file)
@@ -25,8 +25,8 @@
 namespace OC\AppFramework\Middleware\Security;
 
 use OC\AppFramework\Http;
-use OC\AppFramework\Http\RedirectResponse;
 use OC\AppFramework\Utility\MethodAnnotationReader;
+use OCP\AppFramework\Http\RedirectResponse;
 use OCP\AppFramework\Middleware;
 use OCP\AppFramework\Http\Response;
 use OCP\AppFramework\Http\JSONResponse;
diff --git a/lib/public/appframework/http/downloadresponse.php b/lib/public/appframework/http/downloadresponse.php
new file mode 100644 (file)
index 0000000..d3c2818
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+
+/**
+ * ownCloud - App Framework
+ *
+ * @author Bernhard Posselt
+ * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OCP\AppFramework\Http;
+
+
+/**
+ * Prompts the user to download the a file
+ */
+class DownloadResponse extends \OCP\AppFramework\Http\Response {
+
+       private $filename;
+       private $contentType;
+
+       /**
+        * Creates a response that prompts the user to download the file
+        * @param string $filename the name that the downloaded file should have
+        * @param string $contentType the mimetype that the downloaded file should have
+        */
+       public function __construct($filename, $contentType) {
+               $this->filename = $filename;
+               $this->contentType = $contentType;
+
+               $this->addHeader('Content-Disposition', 'attachment; filename="' . $filename . '"');
+               $this->addHeader('Content-Type', $contentType);
+       }
+
+
+}
diff --git a/lib/public/appframework/http/redirectresponse.php b/lib/public/appframework/http/redirectresponse.php
new file mode 100644 (file)
index 0000000..416e153
--- /dev/null
@@ -0,0 +1,57 @@
+<?php
+
+/**
+ * ownCloud - App Framework
+ *
+ * @author Bernhard Posselt
+ * @copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+namespace OCP\AppFramework\Http;
+
+use OCP\AppFramework\Http\Response;
+use OCP\AppFramework\Http;
+
+
+/**
+ * Redirects to a different URL
+ */
+class RedirectResponse extends Response {
+
+       private $redirectURL;
+
+       /**
+        * Creates a response that redirects to a url
+        * @param string $redirectURL the url to redirect to
+        */
+       public function __construct($redirectURL) {
+               $this->redirectURL = $redirectURL;
+               $this->setStatus(Http::STATUS_TEMPORARY_REDIRECT);
+               $this->addHeader('Location', $redirectURL);
+       }
+
+
+       /**
+        * @return string the url to redirect
+        */
+       public function getRedirectURL() {
+               return $this->redirectURL;
+       }
+
+
+}
index 64fe7992b6a83d8f50d345ab61d79e1805ac8b9f..b305c63ad4d297e010aaf2a57fc08e1935e17894 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace OCP\AppFramework\Http;
 
 
 //require_once(__DIR__ . "/../classloader.php");
index f82d0c3a6758bb6387628d07c602faa210ea5b4a..f62b420f4ee69104041802d1ec06671be035003a 100644 (file)
@@ -22,7 +22,7 @@
  */
 
 
-namespace OC\AppFramework\Http;
+namespace OCP\AppFramework\Http;
 
 use OCP\AppFramework\Http;
 
index 63c48a628291edc8ea47ef95d7713fe20fb4c84c..19e8a68c388db12249b06b6a5164986177cebf8d 100644 (file)
@@ -26,7 +26,7 @@ namespace OC\AppFramework\Middleware\Security;
 
 use OC\AppFramework\Http;
 use OC\AppFramework\Http\Request;
-use OC\AppFramework\Http\RedirectResponse;
+use OCP\AppFramework\Http\RedirectResponse;
 use OCP\AppFramework\Http\JSONResponse;