Documentation

Mage_Core_Controller_Request_Http
in package

HTTP Request class wrapping Symfony Request

Provides compatibility layer for Mage_Core_Controller_Request_Http while using Symfony HttpFoundation

Table of Contents

Constants

DEFAULT_HTTP_PORT  : mixed = 80
DEFAULT_HTTPS_PORT  : mixed = 443
SCHEME_HTTP  : mixed = 'http'
SCHEME_HTTPS  : mixed = 'https'
XML_NODE_DIRECT_FRONT_NAMES  : mixed = 'global/request/direct_front_name'

Properties

$_action  : string|null
$_actionKey  : string
$_aliases  : array<string|int, mixed>
Aliases
$_basePath  : string|null
Base path
$_baseUrl  : string|null
Base URL
$_beforeForwardInfo  : array<string|int, mixed>
Request's original information before forward.
$_controller  : string|null
$_controllerKey  : string
$_controllerModule  : string|null
$_directFrontNames  : array<string|int, mixed>|null
$_dispatched  : bool
Has the action been dispatched?
$_internallyForwarded  : bool
Flag for recognizing if request internally forwarded
$_isStraight  : bool
Straight request flag.
$_module  : string|null
Module/Controller/Action info
$_moduleKey  : string
Keys for retrieving MCA from params
$_originalPathInfo  : string
ORIGINAL_PATH_INFO
$_params  : array<string|int, mixed>
Request parameters
$_paramSources  : array<string|int, mixed>
Allowed parameter sources
$_pathInfo  : string
PATH_INFO
$_rawBody  : string|false|null
Raw request body
$_requestedRouteName  : string|null
$_requestString  : string
$_requestUri  : string|null
REQUEST_URI
$_rewritedPathInfo  : array<string|int, mixed>|null
Path info array used before applying rewrite from config
$_route  : string|null
$_routingInfo  : array<string|int, mixed>
$_storeCode  : string|null
$_storeCodeInPath  : bool
$symfonyRequest  : Request
Symfony Request instance

Methods

__construct()  : mixed
__get()  : mixed
__isset()  : bool
__set()  : void
clearParams()  : self
get()  : mixed
getActionKey()  : string
getActionName()  : string|null
getAlias()  : string|null
getAliases()  : array<string|int, mixed>
getBasePath()  : string
getBaseUrl()  : string
getBeforeForwardInfo()  : array<string|int, mixed>|string|null
Retrieve property's value which was before _forward call.
getClientIp()  : string|null
getControllerKey()  : string
getControllerModule()  : string|null
Get module name of currently used controller
getControllerName()  : string|null
getCookie()  : mixed
getDirectFrontNames()  : array<string|int, mixed>
Get list of front names available with access without store code
getEnv()  : mixed
getHeader()  : string|false
getHeaders()  : array<string|int, mixed>
Get all headers
getHost()  : string
Get host from request
getHttpHost()  : false|string
getInternallyForwarded()  : bool
Checks if request was forwarded internally
getMethod()  : string
getModuleKey()  : string
getModuleName()  : string|null
getOriginalPathInfo()  : string
getOriginalRequest()  : self
getParam()  : mixed
getParams()  : array<string|int, mixed>
getParamSources()  : array<string|int, mixed>
getPathInfo()  : string
getPost()  : mixed
getQuery()  : mixed
getRawBody()  : string|false
getRequestedActionName()  : string|null
Get action name used in request (ignore rewrite)
getRequestedControllerName()  : string|null
Get controller name used in request (ignore rewrite)
getRequestedRouteName()  : string|null
Get route name used in request (ignore rewrite)
getRequestString()  : string
getRequestUri()  : string|null
getRouteName()  : string|null
getRoutingInfo()  : array<string|int, mixed>
Get routing info
getScheme()  : string
getServer()  : mixed
getStoreCodeFromPath()  : string|null
getSymfonyRequest()  : Request
Get the Symfony Request instance (for internal use)
getUserParam()  : mixed
getUserParams()  : array<string|int, mixed>
has()  : bool
initForward()  : self
Collect properties changed by _forward in protected storage before _forward was called first time.
isAjax()  : bool
Check is Request from AJAX
isDelete()  : bool
isDirectAccessFrontendName()  : bool
Check if code declared as direct access frontend name this mean what this url can be used without store code
isDispatched()  : bool
isFlashRequest()  : bool
isGet()  : bool
isHead()  : bool
isOptions()  : bool
isPatch()  : bool
isPost()  : bool
isPut()  : bool
isSecure()  : bool
isStoreCodeInPath()  : bool
Whether the request URI carried a store code prefix that setPathInfo() stripped.
isStraight()  : bool
Specify/get _isStraight flag value
isXmlHttpRequest()  : bool
rewritePathInfo()  : self
Specify new path info It happen when occur rewrite based on configuration
set()  : void
setActionKey()  : self
setActionName()  : self
setAlias()  : self
setBasePath()  : self
setBaseUrl()  : self
setBeforeForwardInfo()  : self
Set before forward info
setControllerKey()  : self
setControllerModule()  : self
Specify module name where was found currently used controller
setControllerName()  : self
setDispatched()  : self
setInternallyForwarded()  : self
Define that request was forwarded internally
setIsStraight()  : self
Set _isStraight flag value
setModuleKey()  : self
setModuleName()  : self
setOriginalPathInfo()  : self
Set original path info
setParam()  : self
setParams()  : self
setParamSources()  : self
setPathInfo()  : self
setPost()  : self
setQuery()  : self
setRequestUri()  : self
setRouteName()  : self
setRoutingInfo()  : self
Set routing info data
setStoreCodeFromPath()  : self
Set store code from path
_canBeStoreCodeInUrl()  : bool
Check if can be store code as part of url

Constants

DEFAULT_HTTP_PORT

public mixed DEFAULT_HTTP_PORT = 80

DEFAULT_HTTPS_PORT

public mixed DEFAULT_HTTPS_PORT = 443

SCHEME_HTTP

public mixed SCHEME_HTTP = 'http'

SCHEME_HTTPS

public mixed SCHEME_HTTPS = 'https'

XML_NODE_DIRECT_FRONT_NAMES

public mixed XML_NODE_DIRECT_FRONT_NAMES = 'global/request/direct_front_name'

Properties

$_action

protected string|null $_action = \null

$_actionKey

protected string $_actionKey = 'action'

$_aliases

Aliases

protected array<string|int, mixed> $_aliases = []

$_basePath

Base path

protected string|null $_basePath = \null

$_baseUrl

Base URL

protected string|null $_baseUrl = \null

$_beforeForwardInfo

Request's original information before forward.

protected array<string|int, mixed> $_beforeForwardInfo = []

$_controller

protected string|null $_controller = \null

$_controllerKey

protected string $_controllerKey = 'controller'

$_controllerModule

protected string|null $_controllerModule = \null

$_directFrontNames

protected array<string|int, mixed>|null $_directFrontNames = \null

$_dispatched

Has the action been dispatched?

protected bool $_dispatched = \false

$_internallyForwarded

Flag for recognizing if request internally forwarded

protected bool $_internallyForwarded = \false

$_isStraight

Straight request flag.

protected bool $_isStraight = \false

If flag is determined no additional logic is applicable

$_module

Module/Controller/Action info

protected string|null $_module = \null

$_moduleKey

Keys for retrieving MCA from params

protected string $_moduleKey = 'module'

$_originalPathInfo

ORIGINAL_PATH_INFO

protected string $_originalPathInfo = ''

$_params

Request parameters

protected array<string|int, mixed> $_params = []

$_paramSources

Allowed parameter sources

protected array<string|int, mixed> $_paramSources = ['_GET', '_POST']

$_pathInfo

PATH_INFO

protected string $_pathInfo = ''

$_rawBody

Raw request body

protected string|false|null $_rawBody = \null

$_requestedRouteName

protected string|null $_requestedRouteName = \null

$_requestString

protected string $_requestString = ''

$_requestUri

REQUEST_URI

protected string|null $_requestUri = \null

$_rewritedPathInfo

Path info array used before applying rewrite from config

protected array<string|int, mixed>|null $_rewritedPathInfo = \null

$_route

protected string|null $_route = \null

$_routingInfo

protected array<string|int, mixed> $_routingInfo = []

$_storeCode

protected string|null $_storeCode = \null

$_storeCodeInPath

protected bool $_storeCodeInPath = \false

$symfonyRequest

Symfony Request instance

protected Request $symfonyRequest

Methods

__construct()

public __construct([string|Request|null $uri = null ]) : mixed
Parameters
$uri : string|Request|null = null

__get()

public __get(string $key) : mixed
Parameters
$key : string

__isset()

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

__set()

public __set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

clearParams()

public clearParams() : self
Return values
self

get()

public get(string $key) : mixed
Parameters
$key : string

getActionKey()

public getActionKey() : string
Return values
string

getActionName()

public getActionName() : string|null
Return values
string|null

getAlias()

public getAlias(string $name) : string|null
Parameters
$name : string
Return values
string|null

getAliases()

public getAliases() : array<string|int, mixed>
Return values
array<string|int, mixed>

getBasePath()

public getBasePath() : string
Return values
string

getBaseUrl()

public getBaseUrl([bool $raw = false ]) : string
Parameters
$raw : bool = false
Return values
string

getBeforeForwardInfo()

Retrieve property's value which was before _forward call.

public getBeforeForwardInfo([string|null $name = null ]) : array<string|int, mixed>|string|null

If property was not changed during _forward call null will be returned. If passed name will be null whole state array will be returned.

Parameters
$name : string|null = null
Return values
array<string|int, mixed>|string|null

getClientIp()

public getClientIp([bool $checkProxy = true ]) : string|null
Parameters
$checkProxy : bool = true
Return values
string|null

getControllerKey()

public getControllerKey() : string
Return values
string

getControllerModule()

Get module name of currently used controller

public getControllerModule() : string|null
Return values
string|null

getControllerName()

public getControllerName() : string|null
Return values
string|null

getCookie()

public getCookie([string|null $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string|null = null
$default : mixed = null

getDirectFrontNames()

Get list of front names available with access without store code

public getDirectFrontNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

getEnv()

public getEnv([string|null $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string|null = null
$default : mixed = null

getHeader()

public getHeader(string $header) : string|false
Parameters
$header : string
Return values
string|false

getHeaders()

Get all headers

public getHeaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getHost()

Get host from request

public getHost() : string
Return values
string

getHttpHost()

public getHttpHost([bool $trimPort = true ]) : false|string
Parameters
$trimPort : bool = true
Return values
false|string

getInternallyForwarded()

Checks if request was forwarded internally

public getInternallyForwarded() : bool
Return values
bool

getMethod()

public getMethod() : string
Return values
string

getModuleKey()

public getModuleKey() : string
Return values
string

getModuleName()

public getModuleName() : string|null
Return values
string|null

getOriginalPathInfo()

public getOriginalPathInfo() : string
Return values
string

getOriginalRequest()

public getOriginalRequest() : self
Return values
self

getParam()

public getParam(string|int|null $key[, mixed $default = null ]) : mixed
Parameters
$key : string|int|null
$default : mixed = null

getParams()

public getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParamSources()

public getParamSources() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPathInfo()

public getPathInfo() : string
Return values
string

getPost()

public getPost([string|null $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string|null = null
$default : mixed = null

getQuery()

public getQuery([string|null $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string|null = null
$default : mixed = null

getRawBody()

public getRawBody() : string|false
Return values
string|false

getRequestedActionName()

Get action name used in request (ignore rewrite)

public getRequestedActionName() : string|null
Return values
string|null

getRequestedControllerName()

Get controller name used in request (ignore rewrite)

public getRequestedControllerName() : string|null
Return values
string|null

getRequestedRouteName()

Get route name used in request (ignore rewrite)

public getRequestedRouteName() : string|null
Return values
string|null

getRequestString()

public getRequestString() : string
Return values
string

getRequestUri()

public getRequestUri() : string|null
Return values
string|null

getRouteName()

public getRouteName() : string|null
Return values
string|null

getRoutingInfo()

Get routing info

public getRoutingInfo() : array<string|int, mixed>
Return values
array<string|int, mixed>

getScheme()

public getScheme() : string
Return values
string

getServer()

public getServer([string|null $key = null ][, mixed $default = null ]) : mixed
Parameters
$key : string|null = null
$default : mixed = null

getStoreCodeFromPath()

public getStoreCodeFromPath() : string|null
Return values
string|null

getSymfonyRequest()

Get the Symfony Request instance (for internal use)

public getSymfonyRequest() : Request
Return values
Request

getUserParam()

public getUserParam(string|int $key[, mixed $default = null ]) : mixed
Parameters
$key : string|int
$default : mixed = null

getUserParams()

public getUserParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

has()

public has(string $key) : bool
Parameters
$key : string
Return values
bool

initForward()

Collect properties changed by _forward in protected storage before _forward was called first time.

public initForward() : self
Return values
self

isAjax()

Check is Request from AJAX

public isAjax() : bool
Return values
bool

isDelete()

public isDelete() : bool
Return values
bool

isDirectAccessFrontendName()

Check if code declared as direct access frontend name this mean what this url can be used without store code

public isDirectAccessFrontendName(string $code) : bool
Parameters
$code : string
Return values
bool

isDispatched()

public isDispatched() : bool
Return values
bool

isFlashRequest()

public isFlashRequest() : bool
Return values
bool

isGet()

public isGet() : bool
Return values
bool

isHead()

public isHead() : bool
Return values
bool

isOptions()

public isOptions() : bool
Return values
bool

isPatch()

public isPatch() : bool
Return values
bool

isPost()

public isPost() : bool
Return values
bool

isPut()

public isPut() : bool
Return values
bool

isSecure()

public isSecure() : bool
Return values
bool

isStoreCodeInPath()

Whether the request URI carried a store code prefix that setPathInfo() stripped.

public isStoreCodeInPath() : bool
Return values
bool

isStraight()

Specify/get _isStraight flag value

public isStraight([bool|null $flag = null ]) : bool
Parameters
$flag : bool|null = null
Return values
bool

isXmlHttpRequest()

public isXmlHttpRequest() : bool
Return values
bool

rewritePathInfo()

Specify new path info It happen when occur rewrite based on configuration

public rewritePathInfo(string $pathInfo) : self
Parameters
$pathInfo : string
Return values
self

set()

public set(string $key, mixed $value) : void
Parameters
$key : string
$value : mixed

setActionKey()

public setActionKey(string $key) : self
Parameters
$key : string
Return values
self

setActionName()

public setActionName(string|null $value) : self
Parameters
$value : string|null
Return values
self

setAlias()

public setAlias(string $name, string $target) : self
Parameters
$name : string
$target : string
Return values
self

setBasePath()

public setBasePath([string|null $basePath = null ]) : self
Parameters
$basePath : string|null = null
Return values
self

setBaseUrl()

public setBaseUrl([string|null $baseUrl = null ]) : self
Parameters
$baseUrl : string|null = null
Return values
self

setBeforeForwardInfo()

Set before forward info

public setBeforeForwardInfo(array<string|int, mixed> $info) : self
Parameters
$info : array<string|int, mixed>
Return values
self

setControllerKey()

public setControllerKey(string $key) : self
Parameters
$key : string
Return values
self

setControllerModule()

Specify module name where was found currently used controller

public setControllerModule(string $module) : self
Parameters
$module : string
Return values
self

setControllerName()

public setControllerName(string|null $value) : self
Parameters
$value : string|null
Return values
self

setDispatched()

public setDispatched([bool $flag = true ]) : self
Parameters
$flag : bool = true
Return values
self

setInternallyForwarded()

Define that request was forwarded internally

public setInternallyForwarded([bool $flag = true ]) : self
Parameters
$flag : bool = true
Return values
self

setIsStraight()

Set _isStraight flag value

public setIsStraight(bool $flag) : self
Parameters
$flag : bool
Return values
self

setModuleKey()

public setModuleKey(string $key) : self
Parameters
$key : string
Return values
self

setModuleName()

public setModuleName(string|null $value) : self
Parameters
$value : string|null
Return values
self

setOriginalPathInfo()

Set original path info

public setOriginalPathInfo(string $pathInfo) : self
Parameters
$pathInfo : string
Return values
self

setParam()

public setParam(string|int $key, mixed $value) : self
Parameters
$key : string|int
$value : mixed
Return values
self

setParams()

public setParams(array<string|int, mixed> $array) : self
Parameters
$array : array<string|int, mixed>
Return values
self

setParamSources()

public setParamSources([array<string|int, mixed> $paramSources = [] ]) : self
Parameters
$paramSources : array<string|int, mixed> = []
Return values
self

setPathInfo()

public setPathInfo([string|null $pathInfo = null ]) : self
Parameters
$pathInfo : string|null = null
Return values
self

setPost()

public setPost(array<string|int, mixed>|string $spec[, mixed $value = null ]) : self
Parameters
$spec : array<string|int, mixed>|string
$value : mixed = null
Return values
self

setQuery()

public setQuery(array<string|int, mixed>|string $spec[, mixed $value = null ]) : self
Parameters
$spec : array<string|int, mixed>|string
$value : mixed = null
Return values
self

setRequestUri()

public setRequestUri([string|null $requestUri = null ]) : self
Parameters
$requestUri : string|null = null
Return values
self

setRouteName()

public setRouteName(string $route) : self
Parameters
$route : string
Return values
self

setRoutingInfo()

Set routing info data

public setRoutingInfo(array<string|int, mixed> $data) : self
Parameters
$data : array<string|int, mixed>
Return values
self

setStoreCodeFromPath()

Set store code from path

public setStoreCodeFromPath(string $storeCode) : self
Parameters
$storeCode : string
Return values
self

_canBeStoreCodeInUrl()

Check if can be store code as part of url

protected _canBeStoreCodeInUrl() : bool
Return values
bool
On this page

Search results