Request Client. Processes a Request and handles HTTP_Caching if available. Will usually return a Response object as a result of the request unless an unexpected error occurs.
Class declared in SYSPATH/classes/request/client.php on line 3.
Cache
$_cacheCaching library for request caching
Creates a new Request_Client
object,
allows for dependency injection.
array
$params
= array(0) - Paramspublic function __construct(array $params = array())
{
foreach ($params as $key => $value)
{
if (method_exists($this, $key))
{
$this->$key($value);
}
}
}
Getter and setter for the internal caching engine, used to cache responses if available and valid.
HTTP_Cache
$cache
= NULL - Engine to use for cachingHTTP_Cache
Request_Client
public function cache(HTTP_Cache $cache = NULL)
{
if ($cache === NULL)
return $this->_cache;
$this->_cache = $cache;
return $this;
}
Processes the request, executing the controller action that handles this request, determined by the Route.
By default, the output from the controller is captured and returned, and no headers are sent.
$request->execute();
Request
$request
required - $requestResponse
public function execute(Request $request)
{
if ($this->_cache instanceof HTTP_Cache)
return $this->_cache->execute($this, $request);
return $this->execute_request($request);
}
Processes the request passed to it and returns the response from the URI resource identified.
This method must be implemented by all clients.
Request
$request
required - Request to execute by clientResponse
abstract public function execute_request(Request $request);