Class HTTPRequest

Description

Class HTTPRequest is an implementation of Request for HTTP Requests

It saves all information that is transmitted by the client in a single Request. Such as request headers, the requested method which is used to call the appropriate Service function and of course any data transmitted by the requesting client.

Request inherits from ValueObject and registers the transmitted data to the internal data storage to avoid direct access to the PHP superglobals.

On PUT requests a client must send the Content-Type of the transmitted data as a request header. The PUT data is then transformed from the incoming Content-Type into an array and saved to the ValueObject.

Supported Content-Types by now are:

  • application/json: Incoming data as JSON object literal (http://json.org)
  • text/xml: Incoming data as XML string
  • application/x-www-form-urlencoded: Incoming data as urlencoded key/value pairs separated by ampersand

  • todo: bad request failure handling
  • todo: use xml parser on text/xml PUT requests
  • todo: support more incoming Content-Types for PUT
  • todo: remove subspace dependancy, consolidate uri and subspace
  • todo: remove _FILES and _COOKIE, just transform anything into data
  • todo: put object2array() in a toolbox
  • todo: support upload requests
  • todo: put shift_subspace() in a toolbox

Located in /httprequest.php (line 37)

PHOOL
   |
   --ValueObject
      |
      --Request
         |
         --HTTPRequest
Variable Summary
array $headers
string $method
string $realspace
string $referer
string $root
string $subspace
string $uri
Method Summary
HTTPRequest HTTPRequest ()
array object2array ( $obj)
void shift_subspace ()
array &_COOKIE ()
array &_FILES ()
array &_URI ()
Variables
array $headers (line 43)

The request headers transmitted by the client

  • access: public
string $method (line 49)

The HTTP Request method

  • access: public
string $realspace (line 75)

The real directory space where the main script is located.

  • access: public
string $referer (line 81)

The referring URL of this request

  • access: public
string $root (line 62)

The HTTP server root

  • deprecated:
  • access: public
string $subspace (line 69)

The URI subspace behind the domain root

  • access: public
string $uri (line 55)

The HTTP Request URI

  • access: public

Inherited Variables

Inherited from Request

Request::$meta
Request::$type

Inherited from ValueObject

ValueObject::$data

Inherited from PHOOL

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

Creates a new Request object and registers all needed information

HTTPRequest HTTPRequest ()
object2array (line 234)

Converts a StdClass object into an array

The json_decode function normally creates an object of type StdClass. This function converts that object into an array to fit into the whole concept.

  • access: private
array object2array ( $obj)
  • StdClass $obj: the object to convert
shift_subspace (line 216)

Shift first position from subspace (used for routing or by gateways)

void shift_subspace ()
_COOKIE (line 187)

Return data from _COOKIE

array &_COOKIE ()
_FILES (line 197)

Return data from _FILES

array &_FILES ()
_URI (line 207)

Return data from URI segments

array &_URI ()

Inherited Methods

Inherited From Request

Request::Request()
Request::type()

Inherited From ValueObject

ValueObject::ValueObject()
ValueObject::clear()
ValueObject::erase()
ValueObject::get()
ValueObject::get_all()
ValueObject::get_keys()
ValueObject::get_size()
ValueObject::get_type()
ValueObject::has()
ValueObject::set()
ValueObject::set_all()

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 Request

Request::DS
Request::PS

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