class RestfulService_Response extends SS_HTTPResponse

Methods

__construct(string $body, int $statusCode = 200, $headers = null)

Create a new HTTP response

$this
setStatusCode(int $code, string $description = null)

No description

$this
setStatusDescription(string $description)

The text to be given alongside the status code ("reason phrase").

int
getStatusCode()

No description

string
getStatusDescription()

No description

bool
isError()

Returns true if this HTTP response is in error

$this
setBody(string $body)

No description

null|string
getBody()

No description

$this
addHeader(string $header, string $value)

Add a HTTP header to the response, replacing any header of the same name.

getHeader($header, $anyCase = false)

Return the HTTP header of the given name.

array
getHeaders()

No description

$this
removeHeader(string $header)

Remove an existing HTTP header by its name, e.g. "Content-Type".

$this
redirect(string $dest, int $code = 302)

No description

output()

Send this HTTPReponse to the browser

bool
isFinished()

Returns true if this response is "finished", that is, no more script execution should be done.

simpleXML()

No description

getCachedResponse()

get the cached response object. This allows you to access the cached eaders, not just the cached body.

string|false
getCachedBody()

No description

setCachedBody(string $content) deprecated

No description

setCachedResponse(string $response)

No description

xpath($xpath)

Return an array of xpath matches

xpath_one($xpath)

Return the first xpath match

Details

at line 583
__construct(string $body, int $statusCode = 200, $headers = null)

Create a new HTTP response

Parameters

string $body The body of the response
int $statusCode The numeric status code - 200, 404, etc
$headers

in SS_HTTPResponse at line 114
$this setStatusCode(int $code, string $description = null)

Parameters

int $code
string $description Optional. See {@link setStatusDescription()}. No newlines are allowed in the description. If omitted, will default to the standard HTTP description for the given $code value (see {@link $status_codes}).

Return Value

$this

in SS_HTTPResponse at line 130
$this setStatusDescription(string $description)

The text to be given alongside the status code ("reason phrase").

Caution: Will be overwritten by {@link setStatusCode()}.

Parameters

string $description

Return Value

$this

in SS_HTTPResponse at line 138
int getStatusCode()

Return Value

int

in SS_HTTPResponse at line 145
string getStatusDescription()

Return Value

string Description for a HTTP status code

in SS_HTTPResponse at line 154
bool isError()

Returns true if this HTTP response is in error

Return Value

bool

in SS_HTTPResponse at line 162
$this setBody(string $body)

Parameters

string $body

Return Value

$this

in SS_HTTPResponse at line 170
null|string getBody()

Return Value

null|string

in SS_HTTPResponse at line 181
$this addHeader(string $header, string $value)

Add a HTTP header to the response, replacing any header of the same name.

Parameters

string $header Example: "Content-Type"
string $value Example: "text/xml"

Return Value

$this

in SS_HTTPResponse at line 192
getHeader($header, $anyCase = false)

Return the HTTP header of the given name.

Parameters

$header
$anyCase

in SS_HTTPResponse at line 206
array getHeaders()

Return Value

array

in SS_HTTPResponse at line 217
$this removeHeader(string $header)

Remove an existing HTTP header by its name, e.g. "Content-Type".

Parameters

string $header

Return Value

$this

in SS_HTTPResponse at line 227
$this redirect(string $dest, int $code = 302)

Parameters

string $dest
int $code

Return Value

$this

in SS_HTTPResponse at line 237
output()

Send this HTTPReponse to the browser

in SS_HTTPResponse at line 298
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

Return Value

bool

at line 589
simpleXML()

at line 607
RestfulService_Response|false getCachedResponse()

get the cached response object. This allows you to access the cached eaders, not just the cached body.

Return Value

RestfulService_Response|false The cached response object

at line 614
string|false getCachedBody()

Return Value

string|false

at line 625
setCachedBody(string $content) deprecated

deprecated since version 4.0

Parameters

string $content

at line 638
setCachedResponse(string $response)

Parameters

string $response

at line 645
xpath($xpath)

Return an array of xpath matches

Parameters

$xpath

at line 652
xpath_one($xpath)

Return the first xpath match

Parameters

$xpath