Modules

abstract Kohana_Request_Client

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.

package
Kohana
category
Base
author
Kohana Team
copyright
© 2008-2012 Kohana Team
license
http://kohanaframework.org/license
since
3.1.0

Class declared in SYSPATH/classes/kohana/request/client.php on line 14.

Constants

  • None

Properties

Properties

protected Cache $_cache

Caching library for request caching

Methods

public __construct( [ array $params = array(0) ] ) (defined in Kohana_Request_Client)

Creates a new Request_Client object, allows for dependency injection.

Parameters

  • array $params = array(0) - Params

Source Code

public function __construct(array $params = array())
{
	foreach ($params as $key => $value)
	{
		if (method_exists($this, $key))
		{
			$this->$key($value);
		}
	}
}

public cache( [ HTTP_Cache $cache = NULL ] ) (defined in Kohana_Request_Client)

Getter and setter for the internal caching engine, used to cache responses if available and valid.

Parameters

  • HTTP_Cache $cache = NULL - Engine to use for caching

Return Values

  • HTTP_Cache
  • Request_Client

Source Code

public function cache(HTTP_Cache $cache = NULL)
{
	if ($cache === NULL)
		return $this->_cache;

	$this->_cache = $cache;
	return $this;
}

public execute( Request $request ) (defined in Kohana_Request_Client)

Processes the request, executing the controller action that handles this request, determined by the Route.

  1. Before the controller action is called, the Controller::before method will be called.
  2. Next the controller action will be called.
  3. After the controller action is called, the Controller::after method will be called.

By default, the output from the controller is captured and returned, and no headers are sent.

$request->execute();

Parameters

  • Request $request required - $request

Tags

Return Values

  • Response

Source Code

public function execute(Request $request)
{
	if ($this->_cache instanceof HTTP_Cache)
		return $this->_cache->execute($this, $request);

	return $this->execute_request($request);
}

abstract public execute_request( Request $request ) (defined in Kohana_Request_Client)

Processes the request passed to it and returns the response from the URI resource identified.

This method must be implemented by all clients.

Parameters

  • Request $request required - Request to execute by client

Tags

  • Since - 3.2.0

Return Values

  • Response

Source Code

abstract public function execute_request(Request $request);