Overview
Generic HTTP response object for sending headers, cookies, and content.
This is a fluent class; the set() methods can be chained together like so:
<?php
$response = Solar::factory('Solar_Http_Response');
$response->setStatusCode(404)
->setHeader('X-Foo', 'Bar')
->setCookie('baz', 'dib')
->setContent('Page not found.')
->display();
Configuration Keys
None.
Constants
None.
Public Properties
These are all the public properties in the Solar_Http_Response class.
You can also view the list of all public, protected, and private properties.
-
$content
-
The response body content.
Public Methods
These are all the public methods in the Solar_Http_Response class.
You can also view the list of all public, protected, and private methods.
-
__construct()
-
Constructor.
-
__destruct()
-
Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().
-
__toString()
-
Sends all headers and cookies, then returns the body.
-
display()
-
Sends all headers and cookies, then prints the response content.
-
dump()
-
Dumps the values of this object.
-
getContent()
-
Gets the body content of the response.
-
getCookie()
-
Returns the value and options for a single cookie.
-
getCookies()
-
Returns the array of cookies that will be set by the response.
-
getHeader()
-
Returns the value of a single header.
-
getHeaders()
-
Returns the array of all headers to be sent with the response.
-
getStatusCode()
-
Returns the current status code.
-
getStatusText()
-
Returns the current status text.
-
getVersion()
-
Returns the HTTP version for this response.
-
locale()
-
Looks up class-specific locale strings based on a key.
-
redirect()
-
Issues an immediate "Location" redirect.
-
redirectNoCache()
-
Redirects to another page and action after disabling HTTP caching.
-
setContent()
-
Sets the content of the response.
-
setCookie()
-
Sets a cookie value in $this->_cookies; will be sent to the client at display() time.
-
setCookiesHttponly()
-
By default, should cookies be sent by HTTP only?
-
setHeader()
-
Sets a header value in $this->_headers; will be sent to the client at display() time.
-
setNoCache()
-
Should the response disable HTTP caching?
-
setStatusCode()
-
Sets the HTTP response status code.
-
setStatusText()
-
Sets the HTTP response status text.
-
setVersion()
-
Sets the HTTP version to '1.0' or '1.1'.