HTTPResponse
class HTTPResponse
Represents a response returned by a controller.
Traits
Methods
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Create a new HTTP response
The HTTP version used to respond to this request (typically 1.0 or 1.1)
No description
The text to be given alongside the status code ("reason phrase").
No description
No description
No description
Returns true if this HTTP response is in error
No description
No description
Add a HTTP header to the response, replacing any header of the same name.
Return the HTTP header of the given name.
No description
Remove an existing HTTP header by its name, e.g. "Content-Type".
No description
Send this HTTPResponse to the browser
Returns true if this response is "finished", that is, no more script execution should be done.
Determine if this response is a redirect
The HTTP response represented as a raw string
Details
in Injectable at line 26
static Injectable
create(array $args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
in Injectable at line 43
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
at line 137
__construct(string $body = null, int $statusCode = null, string $statusDescription = null, string $protocolVersion = null)
Create a new HTTP response
at line 160
$this
setProtocolVersion(string $protocolVersion)
The HTTP version used to respond to this request (typically 1.0 or 1.1)
at line 175
$this
setStatusCode(int $code, string $description = null)
at line 199
$this
setStatusDescription(string $description)
The text to be given alongside the status code ("reason phrase").
Caution: Will be overwritten by {@link setStatusCode()}.
at line 208
string
getProtocolVersion()
at line 216
int
getStatusCode()
at line 224
string
getStatusDescription()
at line 234
bool
isError()
Returns true if this HTTP response is in error
at line 245
$this
setBody(string $body)
at line 254
string
getBody()
at line 267
$this
addHeader(string $header, string $value)
Add a HTTP header to the response, replacing any header of the same name.
at line 281
string
getHeader(string $header)
Return the HTTP header of the given name.
at line 293
array
getHeaders()
at line 306
$this
removeHeader(string $header)
Remove an existing HTTP header by its name, e.g. "Content-Type".
at line 319
$this
redirect(string $dest, int $code = 302)
at line 333
output()
Send this HTTPResponse to the browser
at line 429
bool
isFinished()
Returns true if this response is "finished", that is, no more script execution should be done.
Specifically, returns true if a redirect has already been requested
at line 439
bool
isRedirect()
Determine if this response is a redirect
at line 449
string
__toString()
The HTTP response represented as a raw string