Public Member Functions | Public Attributes | Protected Attributes

ResponseHandlerComponent Class Reference

Response handler component. More...

List of all members.

Public Member Functions

 initialize ($controller, $settings=array())
 Initialize self::type from $settings or from extension or from request ACCEPT header.
 startup ($controller)
 The startup Component callback.
 beforeRender ($controller)
 The beforeRender Component callback If self::type was set and is supported (self::typesHandled) set content type header, the right View to use and data for view.
 getType ()
 Return the response type set.
 setType ($type)
 Set the response type that will be used in self::beforeRender().
 sendStatus ($status)
 Send status code to client.
 sendHeader ($name, $value=null)
 Send header to client.

Public Attributes

 $components = array('RequestHandler')
 $controller = null
 $enabled = true
 $xmlFormat = 'tags'

Protected Attributes

 $type = null

Detailed Description

Response handler component.

Handle json/xml response preparing data to serialize and setting up the right View class to use. Help to set headers for the client too.

Definition at line 29 of file response_handler.php.


Member Function Documentation

ResponseHandlerComponent::beforeRender ( controller  ) 

The beforeRender Component callback If self::type was set and is supported (self::typesHandled) set content type header, the right View to use and data for view.

Parameters:
Controller $controller
Returns:
void

Definition at line 124 of file response_handler.php.

ResponseHandlerComponent::getType (  ) 

Return the response type set.

Returns:
string|null

Definition at line 140 of file response_handler.php.

ResponseHandlerComponent::initialize ( controller,
settings = array() 
)

Initialize self::type from $settings or from extension or from request ACCEPT header.

Parameters:
Controller $controller
array $settings
Returns:
void

Definition at line 82 of file response_handler.php.

ResponseHandlerComponent::sendHeader ( name,
value = null 
)

Send header to client.

Parameters:
string $name the header name
string $value the header value
Returns:
void

Definition at line 178 of file response_handler.php.

Referenced by sendStatus().

ResponseHandlerComponent::sendStatus ( status  ) 

Send status code to client.

Parameters:
int $status the http status code as 200, 404, 500, etc...
Returns:
void

Definition at line 161 of file response_handler.php.

References sendHeader().

ResponseHandlerComponent::setType ( type  ) 

Set the response type that will be used in self::beforeRender().

Parameters:
string $type

Definition at line 149 of file response_handler.php.

ResponseHandlerComponent::startup ( controller  ) 

The startup Component callback.

Parameters:
Controller $controller
Returns:
void

Definition at line 114 of file response_handler.php.


The documentation for this class was generated from the following file:
Generated on Fri Dec 11 2015 15:29:47 by Doxygen 1.7.1  BEditaBEdita 3.7 Corylus