add document for NotFoundResponse and ForbiddenResponse

This commit is contained in:
Qingping Hou
2013-03-15 00:54:47 -04:00
parent d35c60881d
commit f98cc739ab
4 changed files with 45 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
ForbiddenResponse
=================
Returns 403 Forbidden status to user.
This Class renders response with HTTP/1.1 403 Forbidden header and empty
content. If you want to return specified content, please extend it with your
own class.
.. php:namespace:: OCA\AppFramework\Http
.. php:class:: ForbiddenResponse
.. php:method:: __construct()
Creates a response that returns HTTP 403 Forbidden status.

View File

@@ -0,0 +1,19 @@
NotFoundResponse
================
Returns 404 Not Found status to user.
This Class renders response with HTTP/1.1 404 Not Found header and empty
content. If you want to return specified content, please extend it with your
own class.
.. php:namespace:: OCA\AppFramework\Http
.. php:class:: NotFoundResponse
.. php:method:: __construct()
Creates a response that returns HTTP 404 Not Found status.

View File

@@ -22,6 +22,8 @@ AppFramework API
http_textdownloadresponse
http_twigresponse
http_request
http_notfoundresponse
http_forbiddenresponse
middleware_middleware
middleware_middlewaredispatcher
middleware_security_securitymiddleware
@@ -82,4 +84,4 @@ Twig Templates
Testing
-------
* :doc:`utility_controllertestutility`
* :doc:`utility_controllertestutility`

View File

@@ -70,6 +70,10 @@ Every controller method has to return a Response object. The currently available
* :php:class:`OCA\\AppFramework\\Http\\TextDownloadResponse`: prompts the user to download a text file containing a passed string
* :php:class:`OCA\\AppFramework\\Http\\TextResponse`: for printing text like XML
.. versionchanged:: 6.0
* :php:class:`OCA\\AppFramework\\Http\\ForbiddenResponse`: returns 403 Forbidden HTTP status
* :php:class:`OCA\\AppFramework\\Http\\NotFoundResponse`: returns 404 Not Found HTTP status
Should you require to set additional headers, you can use the :php:meth:`OCA\\AppFramework\\Http\\Response::addHeader` method that every Response has.