interface ResponseInterface in RESTful 7.2
Hierarchy
- interface \Drupal\restful\Http\ResponseInterface
Expanded class hierarchy of ResponseInterface
All classes that implement ResponseInterface
2 files declare their use of ResponseInterface
- restful.module in ./
restful.module - RestfulManager.php in src/
RestfulManager.php - Contains \Drupal\restful\RestfulManager.
File
- src/
Http/ ResponseInterface.php, line 13 - Contains \Drupal\restful\Http\ResponseInterface.
Namespace
Drupal\restful\HttpView source
interface ResponseInterface {
/**
* Factory.
*
* @param mixed $content
* The response content, see setContent()
* @param int $status
* The response status code
* @param array $headers
* An array of response headers
*
* @return ResponseInterface
* The created object.
*
* @throws UnprocessableEntityException
* When the HTTP status code is not valid
*/
public static function create($content = '', $status = 200, $headers = array());
/**
* Prepares the Response before it is sent to the client.
*
* This method tweaks the Response to ensure that it is
* compliant with RFC 2616. Most of the changes are based on
* the Request that is "associated" with this Response.
*
* @param RequestInterface $request
* A Request instance
*/
public function prepare(RequestInterface $request);
/**
* Sets the response content.
*
* Valid types are strings, numbers, NULL, and objects that implement a __toString() method.
*
* @param mixed $content Content that can be cast to string
*
* @throws InternalServerErrorException
*/
public function setContent($content);
/**
* Gets the current response content.
*
* @return string Content
*/
public function getContent();
/**
* Sets the HTTP protocol version (1.0 or 1.1).
*
* @param string $version The HTTP protocol version
*/
public function setProtocolVersion($version);
/**
* Gets the HTTP protocol version.
*
* @return string The HTTP protocol version
*/
public function getProtocolVersion();
/**
* Sends HTTP headers and content.
*/
public function send();
/**
* Sets the response status code.
*
* @param int $code
* HTTP status code
* @param mixed $text
* HTTP status text
*
* If the status text is NULL it will be automatically populated for the known
* status codes and left empty otherwise.
*
* @throws UnprocessableEntityException When the HTTP status code is not valid
*/
public function setStatusCode($code, $text = NULL);
/**
* Retrieves the status code for the current web response.
*
* @return int Status code
*/
public function getStatusCode();
/**
* Sets the response charset.
*
* @param string $charset Character set
*/
public function setCharset($charset);
/**
* Retrieves the response charset.
*
* @return string Character set
*/
public function getCharset();
/**
* Get the headers bag.
*
* @return HttpHeaderBag
*/
public function getHeaders();
/**
* Sets the Date header.
*
* @param \DateTime $date
* A \DateTime instance
*/
public function setDate(\DateTime $date);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ResponseInterface:: |
public static | function | Factory. | 1 |
ResponseInterface:: |
public | function | Retrieves the response charset. | 1 |
ResponseInterface:: |
public | function | Gets the current response content. | 1 |
ResponseInterface:: |
public | function | Get the headers bag. | 1 |
ResponseInterface:: |
public | function | Gets the HTTP protocol version. | 1 |
ResponseInterface:: |
public | function | Retrieves the status code for the current web response. | 1 |
ResponseInterface:: |
public | function | Prepares the Response before it is sent to the client. | 1 |
ResponseInterface:: |
public | function | Sends HTTP headers and content. | 1 |
ResponseInterface:: |
public | function | Sets the response charset. | 1 |
ResponseInterface:: |
public | function | Sets the response content. | 1 |
ResponseInterface:: |
public | function | Sets the Date header. | 1 |
ResponseInterface:: |
public | function | Sets the HTTP protocol version (1.0 or 1.1). | 1 |
ResponseInterface:: |
public | function | Sets the response status code. | 1 |