diff options
author | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2013-10-06 14:12:35 -0700 |
---|---|---|
committer | Bernhard Posselt <Raydiation@users.noreply.github.com> | 2013-10-06 14:12:35 -0700 |
commit | 381b76ebd0bd9cc6429cf1b335e7de7c2df83794 (patch) | |
tree | 6eeb4ed8dd6c1a0c3f81d8e474726a1abc2b7104 /lib/public | |
parent | 1537410a31e5303207a612f1c0c4b42350ccb4ef (diff) | |
parent | 47b2007228ea770994a76f9c33ad04de1a0cde7e (diff) | |
download | nextcloud-server-381b76ebd0bd9cc6429cf1b335e7de7c2df83794.tar.gz nextcloud-server-381b76ebd0bd9cc6429cf1b335e7de7c2df83794.zip |
Merge pull request #5144 from owncloud/public_middleware
Make abstract Middleware class public
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/appframework/middleware.php (renamed from lib/public/appframework/imiddleware.php) | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lib/public/appframework/imiddleware.php b/lib/public/appframework/middleware.php index 1e76d3bbe49..12776c119c0 100644 --- a/lib/public/appframework/imiddleware.php +++ b/lib/public/appframework/middleware.php @@ -23,6 +23,7 @@ namespace OCP\AppFramework; + use OCP\AppFramework\Http\Response; @@ -32,7 +33,7 @@ use OCP\AppFramework\Http\Response; * They're modeled after Django's middleware system: * https://docs.djangoproject.com/en/dev/topics/http/middleware/ */ -interface IMiddleWare { +abstract class Middleware { /** @@ -43,7 +44,9 @@ interface IMiddleWare { * @param string $methodName the name of the method that will be called on * the controller */ - function beforeController($controller, $methodName); + public function beforeController($controller, $methodName){ + + } /** @@ -60,10 +63,13 @@ interface IMiddleWare { * @throws \Exception the passed in exception if it cant handle it * @return Response a Response object in case that the exception was handled */ - function afterException($controller, $methodName, \Exception $exception); + public function afterException($controller, $methodName, \Exception $exception){ + throw $exception; + } + /** - * This is being run after a successful controller method call and allows + * This is being run after a successful controllermethod call and allows * the manipulation of a Response object. The middleware is run in reverse order * * @param Controller $controller the controller that is being called @@ -72,7 +78,10 @@ interface IMiddleWare { * @param Response $response the generated response from the controller * @return Response a Response object */ - function afterController($controller, $methodName, Response $response); + public function afterController($controller, $methodName, Response $response){ + return $response; + } + /** * This is being run after the response object has been rendered and @@ -84,5 +93,8 @@ interface IMiddleWare { * @param string $output the generated output from a response * @return string the output that should be printed */ - function beforeOutput($controller, $methodName, $output); + public function beforeOutput($controller, $methodName, $output){ + return $output; + } + } |