3 // Copyright (c) 2011 Blue Static
5 // This program is free software: you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License as published by the Free
7 // Software Foundation, either version 3 of the License, or any later version.
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 // You should have received a copy of the GNU General Public License along with
15 // this program. If not, see <http://www.gnu.org/licenses/>.
17 namespace hoplite\http
;
19 require_once HOPLITE_ROOT
. 'base/strict_object.php';
22 A Response holds data processed by Action objects. When the RootController is
23 Run(), a Response object is created. This response is used for any subsequent
24 chained Actions. After processing, the OutputFilter will take the data and
25 formulate the actual HTTP response body.
27 class Response
extends \hoplite
\base\StrictObject
29 /*! @var integer The HTTP response code to return. */
30 public $response_code = ResponseCode
::OK
;
32 /*! @var array A map of headers to values to be sent with the response. */
33 public $headers = array();
35 /*! @var string Raw HTTP response body. */
38 /*! @var array Context data that is not sent to the output filter but is used
39 to store application-specific information between Actions.
41 public $context = array();
43 /*! @var array Model data. */
44 public $data = array();
48 An enumeration of all the HTTP status codes as constants. This is the complete
49 list of codes. Not all will be usable by an application.
50 @see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
55 const 101 = SWITCHING_PROTOCOLS
;
59 const 204 = NO_CONTENT
;
60 const 205 = RESET_CONTENT
;
61 const 206 = PARTIAL_CONTENT
;
62 const 300 = MULTIPLE_CHOICES
;
63 const 301 = MOVED_PERMANENTLY
;
65 const 303 = SEE_OTHER
;
66 const 304 = NOT_MODIFIED
;
67 const 305 = USE_PROXY
;
68 const 307 = TEMPORARY_REDIRECT
;
69 const 400 = BAD_REQUEST
;
70 const 401 = UNAUTHORIZED
;
71 const 402 = PAYMENT_REQUIRED
;
72 const 403 = FORBIDDEN
;
73 const 404 = NOT_FOUND
;
74 const 405 = METHOD_NOT_ALLOWED
;
75 const 406 = NOT_ACCEPTABLE
;
76 const 407 = PROXY_AUTHENTICATION_REQUIRED
;
77 const 408 = REQUEST_TIMEOUT
;
80 const 411 = LENGTH_REQUIRED
;
81 const 412 = PRECONDITION_FAILED
;
82 const 413 = REQUEST_ENTITY_TOO_LARGE
;
83 const 415 = UNSUPPORTED_MEDIA_TYPE
;
84 const 416 = REQUESTED_RANGE_NOT_SATISFIABLE
;
85 const 417 = EXPECTATION_FAILED
;
86 const 500 = INTERNAL_SERVER_ERROR
;
87 const 501 = NOT_IMPLEMENTED
;
88 const 502 = BAD_GATEWAY
;
89 const 503 = SERVICE_UNAVAILABLE
;
90 const 504 = GATEWAY_TIMEOUT
;
91 const 505 = HTTP_VERSION_NOT_SUPPORTED
;