PHP Class Jelix\Routing\ClientRequest

.)
显示文件 Open project: jelix/jelix Class Usage Examples

Public Properties

Property Type Description
$action string the action name ("controller:method")
$authorizedResponseClass the name of the base class for an allowed response for the current request
$defaultResponseType string the type of the default response
$module string the module name
$params array 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 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 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/

Protected Properties

Property Type Description
$urlMapper Jelix\Routing\UrlMapping\UrlActionMapper

Public Methods

Method Description
__construct ( )
getDomainName ( ) : string return the application domain name
getErrorResponse ( $currentResponse ) : Jelix\Routing\ServerResponse
getIP ( ) : string return the ip address of the user
getModuleAction ( ) retrieve module and action fills also $module and $action properties
getParam ( string $name, mixed $defaultValue = null, boolean $useDefaultIfEmpty = false ) : mixed Gets the value of a request parameter. If not defined, gets its default value.
getPort ( $forceHttps = null ) : string return the server port of the application
getProtocol ( ) : string return the protocol
getResponse ( $type = '', boolean $useOriginal = false ) : Jelix\Routing\ServerResponse get a response object.
getServerURI ( $forceHttps = null ) : string return the server URI of the application (protocol + server name + port)
header ( $name )
headers ( )
init ( Jelix\Routing\UrlMapping\UrlActionMapper $urlMapper ) initialize the request : analyse of http request etc.
isAjax ( ) : boolean says if this is an ajax request
isAllowedResponse ( Jelix\Routing\ServerResponse $response ) : boolean
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

Protected Methods

Method Description
_initParams ( ) analyse the http request and sets the params property
_initUrlData ( ) init the url* properties

Private Methods

Method Description
_generateHeaders ( )

Method Details

__construct() public method

public __construct ( )

_initParams() abstract protected method

analyse the http request and sets the params property
abstract protected _initParams ( )

_initUrlData() protected method

init the url* properties
protected _initUrlData ( )

getDomainName() public method

return the application domain name
Since: 1.2.3
public getDomainName ( ) : string
return string

getErrorResponse() public method

public getErrorResponse ( $currentResponse ) : Jelix\Routing\ServerResponse
return Jelix\Routing\ServerResponse

getIP() public method

return the ip address of the user
public getIP ( ) : string
return string the ip

getModuleAction() public method

retrieve module and action fills also $module and $action properties
public getModuleAction ( )

getParam() public method

Gets the value of a request parameter. If not defined, gets its default value.
public getParam ( string $name, mixed $defaultValue = null, boolean $useDefaultIfEmpty = false ) : mixed
$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 ""
return mixed the request parameter value

getPort() public method

return the server port of the application
Since: 1.2.4
public getPort ( $forceHttps = null ) : string
return string the ":port" or empty string

getProtocol() public method

return the protocol
Since: 1.2
public getProtocol ( ) : string
return string http:// or https://

getResponse() public method

get a response object.
public getResponse ( $type = '', boolean $useOriginal = false ) : Jelix\Routing\ServerResponse
$useOriginal boolean true:don't use the response object redefined by the application
return Jelix\Routing\ServerResponse the response object

getServerURI() public method

return the server URI of the application (protocol + server name + port)
Since: 1.2.4
public getServerURI ( $forceHttps = null ) : string
return string the serveur uri

header() public method

public header ( $name )

headers() public method

public headers ( )

init() public method

.
public init ( Jelix\Routing\UrlMapping\UrlActionMapper $urlMapper )
$urlMapper Jelix\Routing\UrlMapping\UrlActionMapper

isAjax() public method

says if this is an ajax request
Since: 1.3a1
public isAjax ( ) : boolean
return boolean true if it is an ajax request

isAllowedResponse() public method

public isAllowedResponse ( Jelix\Routing\ServerResponse $response ) : boolean
$response Jelix\Routing\ServerResponse the response
return boolean true if the given class is allowed for the current request

readHttpBody() public method

call it when you want to read the content of the body of a request when the method is not GET or POST
Since: 1.2
public readHttpBody ( ) : mixed
return mixed array of parameters or a single string when the content-type is unknown

Property Details

$action public_oe property

the action name ("controller:method")
public string $action
return string

$authorizedResponseClass public_oe property

the name of the base class for an allowed response for the current request
public $authorizedResponseClass

$defaultResponseType public_oe property

the type of the default response
public string $defaultResponseType
return string

$module public_oe property

the module name
public string $module
return string

$params public_oe property

request parameters could set from $_GET, $_POST, or from php://input data
public array $params
return array

$type public_oe property

the request type code
public string $type
return string

$urlMapper protected_oe property

protected UrlActionMapper,Jelix\Routing\UrlMapping $urlMapper
return Jelix\Routing\UrlMapping\UrlActionMapper

$urlPathInfo public_oe property

the pathinfo part of the url if the url is /foo/index.php/bar, its value is /bar
public string $urlPathInfo
return string

$urlScript public_oe property

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
public string $urlScript
return string

$urlScriptName public_oe property

the name of the entry point if the url is /foo/index.php/bar, its value is index.php
public string $urlScriptName
return string

$urlScriptPath public_oe property

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
return string