diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-01-22 20:26:46 +0100 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2015-02-27 15:42:33 +0100 |
commit | 95239ad21e113d7d25d5844b0ac5f15a606f2140 (patch) | |
tree | 384279227d5255640f3dec2c2e86b65e025b7df5 /lib/public/appframework/http/icallbackresponse.php | |
parent | 06141ed95a87e40dded4db6bedc4b643cdfdda0e (diff) | |
download | nextcloud-server-95239ad21e113d7d25d5844b0ac5f15a606f2140.tar.gz nextcloud-server-95239ad21e113d7d25d5844b0ac5f15a606f2140.zip |
AppFramework StreamResponse
First stab at the StreamResponse, see #12988
The idea is to use an interface ICallbackResponse (I'm not 100% happy with the name yet, suggestions?) that allow the response to output things in its own way, for instance stream the file using readfile
Unittests are atm lacking, plan is to
check if a mock of ICallbackResponse will be used by calling its callback (also unhappy with this name) method
Usage is:
$response = new StreamResponse('path/to/file');
rename io to output, add additional methods and handle error and not modified cases when using StreamResponse
fix indention and uppercasing, also handle forbidden cases
fix indention
fix indention
no forbidden, figuring out if a file is really readable is too complicated to get to work across OSes and streams
remove useless import
remove useless import
fix intendation
Diffstat (limited to 'lib/public/appframework/http/icallbackresponse.php')
-rw-r--r-- | lib/public/appframework/http/icallbackresponse.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/public/appframework/http/icallbackresponse.php b/lib/public/appframework/http/icallbackresponse.php new file mode 100644 index 00000000000..4a392ed081d --- /dev/null +++ b/lib/public/appframework/http/icallbackresponse.php @@ -0,0 +1,28 @@ +<?php +/** + * @author Bernhard Posselt + * @copyright 2015 Bernhard Posselt <dev@bernhard-posselt.com> + * + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCP\AppFramework\Http; + + +/** + * Interface ICallbackResponse + * + * @package OCP\AppFramework\Http + */ +interface ICallbackResponse { + + /** + * Outputs the content that should be printed + * + * @param IOutput a small wrapper that handles output + */ + function callback(IOutput $output); + +} |