jRequest

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

.)

package

jelix

subpackage

core_request

Methods

__construct

__construct() 

_generateHeaders

_generateHeaders() 

analyse the http request and sets the params property

_initParams() 
abstract

init the url* properties

_initUrlData() 

return the application domain name

getDomainName() : string
since 1.2.3

Response

string

getErrorResponse

getErrorResponse( $currentResponse) : \jResponse

Arguments

$currentResponse

Response

\jResponse

return the ip address of the user

getIP() : string

Response

string

the ip

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

getModuleAction() 

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

getParam(string $name, mixed $defaultValue = null, boolean $useDefaultIfEmpty = false) : mixed

Arguments

$name

string

the name of the request parameter

$defaultValue

mixed

the default returned value if the parameter doesn't exists

$useDefaultIfEmpty

boolean

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

Response

mixed

the request parameter value

return the server port of the application

getPort( $forceHttps = null) : string
since 1.2.4

Arguments

$forceHttps

Response

string

the ":port" or empty string

return the protocol

getProtocol() : string
since 1.2

Response

string

http:// or https://

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

getServerURI( $forceHttps = null) : string
since 1.2.4

Arguments

$forceHttps

Response

string

the serveur uri

header

header( $name) 

Arguments

$name

headers

headers() 

initialize the request : analyse of http request etc.

init() 

.

says if this is an ajax request

isAjax() : boolean
since 1.3a1

Response

boolean

true if it is an ajax request

isAllowedResponse

isAllowedResponse(\jResponse $response) : boolean

Arguments

$response

\jResponse

the response

Response

boolean

true if the given class is allowed for the current request

isHttps

isHttps() : boolean
todo

support Forwarded and X-Forwared-Proto headers

Response

boolean

true if the request is made with HTTPS

Says if the request method is POST

isPostMethod() : boolean
since 1.6.17

Response

boolean

parseMultipartBody

parseMultipartBody( $contentType,  $input) 
static

Arguments

$contentType

$input

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

readHttpBody() : mixed
since 1.2

Response

mixed

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

Properties

request parameters could set from $_GET, $_POST, or from data processing of $HTTP_RAW_POST_DATA

params : array
var

Type(s)

array

the request type code

type : string
var

Type(s)

string

the type of the default response

defaultResponseType : string
var

Type(s)

string

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

authorizedResponseClass : string
var

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

Type(s)

string

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

urlScriptPath : string
var

Type(s)

string

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

urlScriptName : string
var

Type(s)

string

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

urlScript : string

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

var

Type(s)

string

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

urlPathInfo : string
var

Type(s)

string

the module name

module : string
var

Type(s)

string

the action name ("controller:method")

action : string
var

Type(s)

string

_headers

_headers : 

Type(s)