Jelix 1.8.13

jRequest
in package

base class for object which retrieve all parameters of an http request. The process depends on the type of request (ex: xmlrpc..).

Tags
subpackage

core_request

Table of Contents

$action  : string
the action name ("controller:method").
$authorizedResponseClass  : string
$defaultResponseType  : string
the type of the default response.
$module  : string
the module name.
$params  : array<string|int, mixed>
request parameters could set from $_GET, $_POST, or from php://input data.
$type  : string
the request type code.
$urlPathInfo  : string
the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar.
$urlScript  : string
the path to the entry point in the url if the url is /foo/index.php/bar, its value is /foo/index.php.
$urlScriptName  : string
the name of the entry point if the url is /foo/index.php/bar, its value is index.php.
$urlScriptPath  : string
the path of the entry point in the url (basePath included) if the url is /foo/index.php/bar, its value is /foo/.
$_rawBody  : mixed
$urlMapper  : UrlActionMapper
$_headers  : mixed
__construct()  : mixed
getBody()  : string
Get the raw content of the request body (from php://input).
getDomainName()  : string
return the application domain name.
getErrorResponse()  : jResponse
getIP()  : string
return the ip address of the user.
getModuleAction()  : mixed
retrieve module and action fills also $module and $action properties.
getParam()  : mixed
Gets the value of a request parameter. If not defined, gets its default value.
getPort()  : string
return the server port of the application.
getProtocol()  : string
return the protocol.
getServerURI()  : string
return the server URI of the application (protocol + server name + port).
header()  : mixed
headers()  : mixed
init()  : mixed
initialize the request : analyse of http request etc.
isAjax()  : bool
says if this is an ajax request.
isAllowedResponse()  : bool
isHttps()  : bool
isPostMethod()  : bool
Says if the request method is POST.
parseMultipartBody()  : mixed
readHttpBody()  : mixed
call it when you want to read the content of the body of a request when the method is not GET or POST.
_initParams()  : mixed
analyse the http request and sets the params property.
_initUrlData()  : mixed
init the url* properties.
_generateHeaders()  : mixed

Properties

$action

the action name ("controller:method").

public string $action = ''
Tags

$authorizedResponseClass

public string $authorizedResponseClass = ''

the name of the base class for an allowed response for the current request

Tags

$defaultResponseType

the type of the default response.

public string $defaultResponseType = ''
Tags

$params

request parameters could set from $_GET, $_POST, or from php://input data.

public array<string|int, mixed> $params = array()
Tags

$urlPathInfo

the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar.

public string $urlPathInfo
Tags

$urlScript

the path to the entry point in the url if the url is /foo/index.php/bar, its value is /foo/index.php.

public string $urlScript

Warning: if the app is behind a proxy, the path includes the backendBasePath, not the basePath. Use urlScriptPath and urlScriptName to have the "public" url, as needed for the frontend HTTP server.

Tags

$urlScriptName

the name of the entry point if the url is /foo/index.php/bar, its value is index.php.

public string $urlScriptName
Tags

$urlScriptPath

the path of the entry point in the url (basePath included) if the url is /foo/index.php/bar, its value is /foo/.

public string $urlScriptPath
Tags

Methods

__construct()

public __construct() : mixed
Tags
Return values
mixed

getBody()

Get the raw content of the request body (from php://input).

public getBody() : string
Tags
since
1.7
Return values
string

getDomainName()

return the application domain name.

public getDomainName() : string
Tags
since
1.2.3
Return values
string

getIP()

return the ip address of the user.

public getIP() : string
Tags
Return values
string

the ip

getModuleAction()

retrieve module and action fills also $module and $action properties.

public getModuleAction() : mixed
Tags
Return values
mixed

getParam()

Gets the value of a request parameter. If not defined, gets its default value.

public getParam(string $name[, mixed $defaultValue = null ][, bool $useDefaultIfEmpty = false ]) : mixed
Parameters
$name : string

the name of the request parameter

$defaultValue : mixed = null

the default returned value if the parameter doesn't exists

$useDefaultIfEmpty : bool = false

true: says to return the default value if the parameter value is ""

Tags
Return values
mixed

the request parameter value

getPort()

return the server port of the application.

public getPort([null|mixed $forceHttps = null ]) : string
Parameters
$forceHttps : null|mixed = null
Tags
since
1.2.4
Return values
string

the ":port" or empty string

getProtocol()

return the protocol.

public getProtocol() : string
Tags
since
1.2
Return values
string

http:// or https://

getServerURI()

return the server URI of the application (protocol + server name + port).

public getServerURI([null|mixed $forceHttps = null ]) : string
Parameters
$forceHttps : null|mixed = null
Tags
since
1.2.4
Return values
string

the serveur uri

header()

public header(mixed $name) : mixed
Parameters
$name : mixed
Tags
Return values
mixed

headers()

public headers() : mixed
Tags
Return values
mixed

isAjax()

says if this is an ajax request.

public isAjax() : bool
Tags
since
1.3a1
Return values
bool

true if it is an ajax request

isAllowedResponse()

public isAllowedResponse(jResponse $response) : bool
Parameters
$response : jResponse

the response

Tags
Return values
bool

true if the given class is allowed for the current request

isHttps()

public isHttps() : bool
Tags
Return values
bool

true if the request is made with HTTPS

isPostMethod()

Says if the request method is POST.

public isPostMethod() : bool
Tags
since
1.6.17
Return values
bool

parseMultipartBody()

public static parseMultipartBody(mixed $contentType, mixed $input) : mixed
Parameters
$contentType : mixed
$input : mixed
Tags
Return values
mixed

readHttpBody()

call it when you want to read the content of the body of a request when the method is not GET or POST.

public readHttpBody() : mixed
Tags
since
1.2
Return values
mixed

array of parameters or a single string when the content-type is unknown

_initParams()

analyse the http request and sets the params property.

protected abstract _initParams() : mixed
Tags
Return values
mixed

_initUrlData()

init the url* properties.

protected _initUrlData() : mixed
Tags
Return values
mixed

_generateHeaders()

private _generateHeaders() : mixed
Tags
Return values
mixed

Search results