ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
The Request class represents a single HTTP request. More...
Public Member Functions | |
__construct ($method=null, $url=null, array $headers=null, $body=null) | |
Creates the request object. More... | |
getMethod () | |
Returns the current HTTP method. More... | |
setMethod ($method) | |
Sets the HTTP method. More... | |
getUrl () | |
Returns the request url. More... | |
setUrl ($url) | |
Sets the request url. More... | |
getQueryParameters () | |
Returns the list of query parameters. More... | |
setAbsoluteUrl ($url) | |
Sets the absolute url. More... | |
getAbsoluteUrl () | |
Returns the absolute url. More... | |
setBaseUrl ($url) | |
Sets a base url. More... | |
getBaseUrl () | |
Returns the current base url. More... | |
getPath () | |
Returns the relative path. More... | |
setPostData (array $postData) | |
Sets the post data. More... | |
getPostData () | |
Returns the POST data. More... | |
getRawServerValue ($valueName) | |
Returns an item from the _SERVER array. More... | |
setRawServerData (array $data) | |
Sets the _SERVER array. More... | |
__toString () | |
Serializes the request object as a string. More... | |
Public Member Functions inherited from Sabre\HTTP\Message | |
getBodyAsStream () | |
Returns the body as a readable stream resource. More... | |
getBodyAsString () | |
Returns the body as a string. More... | |
getBody () | |
Returns the message body, as it's internal representation. More... | |
setBody ($body) | |
Replaces the body resource with a new stream or string. More... | |
getHeaders () | |
Returns all the HTTP headers as an array. More... | |
hasHeader ($name) | |
Will return true or false, depending on if a HTTP header exists. More... | |
getHeader ($name) | |
Returns a specific HTTP header, based on it's name. More... | |
getHeaderAsArray ($name) | |
Returns a HTTP header as an array. More... | |
setHeader ($name, $value) | |
Updates a HTTP header. More... | |
setHeaders (array $headers) | |
Sets a new set of HTTP headers. More... | |
addHeader ($name, $value) | |
Adds a HTTP header. More... | |
addHeaders (array $headers) | |
Adds a new set of HTTP headers. More... | |
removeHeader ($name) | |
Removes a HTTP header. More... | |
setHttpVersion ($version) | |
Sets the HTTP version. More... | |
getHttpVersion () | |
Returns the HTTP version. More... | |
Protected Attributes | |
$method | |
$url | |
$baseUrl = '/' | |
$postData = [] | |
$rawServerData | |
Protected Attributes inherited from Sabre\HTTP\Message | |
$body | |
$headers = [] | |
$httpVersion = '1.1' | |
The Request class represents a single HTTP request.
You can either simply construct the object from scratch, or if you need access to the current HTTP request, use Sapi::getRequest.
Definition at line 18 of file Request.php.
Sabre\HTTP\Request::__construct | ( | $method = null , |
|
$url = null , |
|||
array | $headers = null , |
||
$body = null |
|||
) |
Creates the request object.
string | $method | |
string | $url | |
array | $headers | |
resource | $body |
Definition at line 42 of file Request.php.
References Sabre\HTTP\Message\$body, Sabre\HTTP\Message\$headers, Sabre\HTTP\Request\$method, Sabre\HTTP\Request\$url, Sabre\HTTP\Message\setBody(), Sabre\HTTP\Message\setHeaders(), Sabre\HTTP\Request\setMethod(), and Sabre\HTTP\Request\setUrl().
Sabre\HTTP\Request::__toString | ( | ) |
Serializes the request object as a string.
This is useful for debugging purposes.
Definition at line 296 of file Request.php.
References $key, $out, Sabre\HTTP\Message\getBodyAsString(), Sabre\HTTP\Message\getHeaders(), Sabre\HTTP\Request\getMethod(), and Sabre\HTTP\Request\getUrl().
Sabre\HTTP\Request::getAbsoluteUrl | ( | ) |
Returns the absolute url.
Implements Sabre\HTTP\RequestInterface.
Definition at line 136 of file Request.php.
Sabre\HTTP\Request::getBaseUrl | ( | ) |
Returns the current base url.
Implements Sabre\HTTP\RequestInterface.
Definition at line 168 of file Request.php.
References Sabre\HTTP\Request\$baseUrl.
Referenced by Sabre\HTTP\Request\getPath().
Sabre\HTTP\Request::getMethod | ( | ) |
Returns the current HTTP method.
Implements Sabre\HTTP\RequestInterface.
Definition at line 59 of file Request.php.
References Sabre\HTTP\Request\$method.
Referenced by Sabre\HTTP\Request\__toString().
Sabre\HTTP\Request::getPath | ( | ) |
Returns the relative path.
This is being calculated using the base url. This path will not start with a slash, so it will always return something like 'example/path.html'.
If the full path is equal to the base url, this method will return an empty string.
This method will also urldecode the path, and if the url was incoded as ISO-8859-1, it will convert it to UTF-8.
If the path is outside of the base url, a LogicException will be thrown.
Implements Sabre\HTTP\RequestInterface.
Definition at line 191 of file Request.php.
References $baseUri, Sabre\HTTP\URLUtil\decodePath(), Sabre\HTTP\Request\getBaseUrl(), Sabre\HTTP\Request\getUrl(), and Sabre\Uri\normalize().
Sabre\HTTP\Request::getPostData | ( | ) |
Returns the POST data.
This is equivalent to PHP's $_POST superglobal.
Implements Sabre\HTTP\RequestInterface.
Definition at line 248 of file Request.php.
References Sabre\HTTP\Request\$postData.
Sabre\HTTP\Request::getQueryParameters | ( | ) |
Returns the list of query parameters.
This is equivalent to PHP's $_GET superglobal.
Implements Sabre\HTTP\RequestInterface.
Definition at line 107 of file Request.php.
References $index, Sabre\HTTP\Request\$url, and Sabre\HTTP\Request\getUrl().
Sabre\HTTP\Request::getRawServerValue | ( | $valueName | ) |
Returns an item from the _SERVER array.
If the value does not exist in the array, null is returned.
string | $valueName |
Implements Sabre\HTTP\RequestInterface.
Definition at line 269 of file Request.php.
Sabre\HTTP\Request::getUrl | ( | ) |
Returns the request url.
Implements Sabre\HTTP\RequestInterface.
Definition at line 82 of file Request.php.
References Sabre\HTTP\Request\$url.
Referenced by Sabre\HTTP\Request\__toString(), Sabre\HTTP\Request\getPath(), and Sabre\HTTP\Request\getQueryParameters().
Sabre\HTTP\Request::setAbsoluteUrl | ( | $url | ) |
Sets the absolute url.
string | $url |
Implements Sabre\HTTP\RequestInterface.
Definition at line 125 of file Request.php.
References Sabre\HTTP\Request\$url.
Sabre\HTTP\Request::setBaseUrl | ( | $url | ) |
Sets a base url.
This url is used for relative path calculations.
string | $url |
Implements Sabre\HTTP\RequestInterface.
Definition at line 157 of file Request.php.
References Sabre\HTTP\Request\$url.
Sabre\HTTP\Request::setMethod | ( | $method | ) |
Sets the HTTP method.
string | $method |
Implements Sabre\HTTP\RequestInterface.
Definition at line 71 of file Request.php.
References Sabre\HTTP\Request\$method.
Referenced by Sabre\HTTP\Request\__construct().
Sabre\HTTP\Request::setPostData | ( | array | $postData | ) |
Sets the post data.
This is equivalent to PHP's $_POST superglobal.
This would not have been needed, if POST data was accessible as php://input, but unfortunately we need to special case it.
array | $postData |
Implements Sabre\HTTP\RequestInterface.
Definition at line 235 of file Request.php.
References Sabre\HTTP\Request\$postData.
Sabre\HTTP\Request::setRawServerData | ( | array | $data | ) |
Sets the _SERVER array.
array | $data |
Implements Sabre\HTTP\RequestInterface.
Definition at line 283 of file Request.php.
References $data.
Sabre\HTTP\Request::setUrl | ( | $url | ) |
Sets the request url.
string | $url |
Implements Sabre\HTTP\RequestInterface.
Definition at line 94 of file Request.php.
References Sabre\HTTP\Request\$url.
Referenced by Sabre\HTTP\Request\__construct().
|
protected |
Definition at line 147 of file Request.php.
Referenced by Sabre\HTTP\Request\getBaseUrl().
|
protected |
Definition at line 25 of file Request.php.
Referenced by Sabre\HTTP\Request\__construct(), Sabre\HTTP\Request\getMethod(), and Sabre\HTTP\Request\setMethod().
|
protected |
Definition at line 222 of file Request.php.
Referenced by Sabre\HTTP\Request\getPostData(), and Sabre\HTTP\Request\setPostData().
|
protected |
Definition at line 259 of file Request.php.
|
protected |
Definition at line 32 of file Request.php.
Referenced by Sabre\HTTP\Request\__construct(), Sabre\HTTP\Request\getQueryParameters(), Sabre\HTTP\Request\getUrl(), Sabre\HTTP\Request\setAbsoluteUrl(), Sabre\HTTP\Request\setBaseUrl(), and Sabre\HTTP\Request\setUrl().