Class HTTPResponse

Description

HTTPResponse is the result of a processed request.

It contains headers and content to be sent to a web-client. HTTP Statuscode as well as headers and content may be altered using the methods inside the class.

  • todo: remove charset encoding from sendBody. Use a conversion filter instead.
  • todo: support more http status messages
  • todo: create more response types for assets

Located in /httpresponse.php (line 21)

PHOOL
   |
   --HTTPResponse
Direct descendents
Class Description
Forbidden A default HTTP 403 Response to be returned by a Gateway
NotAllowed A default HTTP 405 Response to be returned by Gateway Firewalls
ConditionFailed A default HTTP 412 Response to be returned on PRE Filter Failures
NoContent A default HTTP 204 Response to be returned as an empty Response
NotAccepted A default HTTP 406 Response to be returned by a Conversion Filter
BadRequest A default HTTP 400 Response to be returned on Request Failures
NotFound A default HTTP 404 Response to be returned by Dispatcher failures
A default HTTP 500 Response to be returned on Runtime Errors
Created A default HTTP 201 Response to be returned as result of PUT requests
Authenticate Default Authentication Response for HTTP Basic or Digest
View Class View is the base class for application Views.
Variable Summary
string $content
string $contentType
string $encoding
array $headers
string $protocol
int $status
Method Summary
HTTPResponse HTTPResponse ([ $status = 200], [ $content = ""])
void appendContent (string $str)
void send ()
void sendBody ()
void sendHeaders ()
void sendStatus ()
void setContent (string $content)
void setEncoding (string $encoding)
void setHeader (string $name, string $value)
void setStatus (int $status)
void __tostring ()
Variables
string $content (line 57)

The Response body

  • access: public
string $contentType (line 39)

The Content-Type of the Response

  • access: public
string $encoding (line 45)

The content charset encoding of the Response

  • access: public
array $headers (line 51)

A list of headers related to the Response

  • access: public
string $protocol (line 27)

The HTTP protocol version of the Response

  • access: public
int $status (line 33)

The HTTP status code of the Response

  • access: public

Inherited Variables

Inherited from PHOOL

PHOOL::$debug
PHOOL::$errorlabels
PHOOL::$errorlevels
PHOOL::$errors
PHOOL::$exists
PHOOL::$logdir
PHOOL::$loglevel
PHOOL::$objname
Methods
Constructor HTTPResponse (line 62)

Construct a HTTPResponse

HTTPResponse HTTPResponse ([ $status = 200], [ $content = ""])
  • $status
  • $content
appendContent (line 152)

Append a string to the content-body of the responses

void appendContent (string $str)
  • string $str: content to append
send (line 78)

Send Response to client

void send ()
sendBody (line 222)

Send the content body of this Response to the client

  • access: protected
void sendBody ()
sendHeaders (line 202)

Send all HTTP headers of this Response to the client

  • access: protected
void sendHeaders ()
sendStatus (line 161)

Send a HTTP Status header with message

  • access: protected
void sendStatus ()
setContent (line 142)

Set a content body for the Response

void setContent (string $content)
  • string $content: response body
setEncoding (line 132)

Update the content body encoding

void setEncoding (string $encoding)
  • string $encoding: charset name
setHeader (line 99)

Add a HTTP-header to the Response

Name and Value are concatenated with a colon to create a full header.

void setHeader (string $name, string $value)
  • string $name: name of header
  • string $value: value of the header
setStatus (line 122)

Update the HTTP statuscode of the Response

void setStatus (int $status)
  • int $status: the statuscode
__tostring (line 234)

Disallow string conversion of HTTPresponses

void __tostring ()

Inherited Methods

Inherited From PHOOL

PHOOL::PHOOL()
PHOOL::debug()
PHOOL::error()
PHOOL::get_errors()
PHOOL::handle_error()
PHOOL::has_error()
PHOOL::log_error()
PHOOL::set_debug()
PHOOL::set_logdir()
PHOOL::set_loglevel()
Class Constants

Inherited Constants

Inherited from PHOOL

PHOOL::ERROR
PHOOL::UNKNOWN
PHOOL::USER
PHOOL::WARNING

Documentation generated on Tue, 12 May 2009 23:09:39 +0200 by phpDocumentor 1.4.1