jClassicRequest
extends jRequest
in package
handle "classical" request it just gets parameters from the url query and the post content. And responses can be in many format : text, html, xml.
..
Tags
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 data processing of $HTTP_RAW_POST_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/
- $_headers : mixed
- __construct() : mixed
- 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
= ''
$authorizedResponseClass
public
string
$authorizedResponseClass
= ''
the name of the base class for an allowed response for the current request
$defaultResponseType
the type of the default response
public
string
$defaultResponseType
= 'html'
$module
the module name
public
string
$module
= ''
$params
request parameters could set from $_GET, $_POST, or from data processing of $HTTP_RAW_POST_DATA
public
array<string|int, mixed>
$params
= array()
$type
the request type code
public
string
$type
= 'classic'
$urlPathInfo
the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar
public
string
$urlPathInfo
$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
$urlScriptName
the name of the entry point if the url is /foo/index.php/bar, its value is index.php
public
string
$urlScriptName
$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
$_headers
private
mixed
$_headers
=
ull
Methods
__construct()
public
__construct() : mixed
Return values
mixed —getDomainName()
return the application domain name
public
getDomainName() : string
Tags
Return values
string —getErrorResponse()
public
getErrorResponse(mixed $currentResponse) : jResponse
Parameters
- $currentResponse : mixed
Return values
jResponse —getIP()
return the ip address of the user
public
getIP() : string
Return values
string —the ip
getModuleAction()
retrieve module and action fills also $module and $action properties
public
getModuleAction() : mixed
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 ""
Return values
mixed —the request parameter value
getPort()
return the server port of the application
public
getPort([mixed $forceHttps = null ]) : string
Parameters
- $forceHttps : mixed = null
Tags
Return values
string —the ":port" or empty string
getProtocol()
return the protocol
public
getProtocol() : string
Tags
Return values
string —http:// or https://
getServerURI()
return the server URI of the application (protocol + server name + port)
public
getServerURI([mixed $forceHttps = null ]) : string
Parameters
- $forceHttps : mixed = null
Tags
Return values
string —the serveur uri
header()
public
header(mixed $name) : mixed
Parameters
- $name : mixed
Return values
mixed —headers()
public
headers() : mixed
Return values
mixed —init()
initialize the request : analyse of http request etc.
public
init() : mixed
.
Return values
mixed —isAjax()
says if this is an ajax request
public
isAjax() : bool
Tags
Return values
bool —true if it is an ajax request
isAllowedResponse()
public
isAllowedResponse(jResponse $response) : bool
Parameters
- $response : jResponse
-
the response
Return values
bool —true if the given class is allowed for the current request
isHttps()
public
isHttps() : bool
Return values
bool —true if the request is made with HTTPS
isPostMethod()
Says if the request method is POST
public
isPostMethod() : bool
Tags
Return values
bool —parseMultipartBody()
public
static parseMultipartBody(mixed $contentType, mixed $input) : mixed
Parameters
- $contentType : mixed
- $input : mixed
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
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
_initParams() : mixed
Return values
mixed —_initUrlData()
init the url* properties
protected
_initUrlData() : mixed
Return values
mixed —_generateHeaders()
private
_generateHeaders() : mixed