SessionAwareWebApplicationInterface

Extends WebApplicationInterface

Application sub-interface defining a web application class which supports sessions

since

2.0.0

package

Joomla Framework

Methods

allowCache

Set/get cachable state for the response.

allowCache(bool allow = null) : bool
inherited

If $allow is set, sets the cachable state of the response. Always returns the current state.

since

2.0.0

Arguments

allow

boolTrue to allow browser caching.

Response

bool

appendBody

Append content to the body content

appendBody(string content) : $this
inherited
since

2.0.0

Arguments

content

stringThe content to append to the response body.

Response

$this

checkToken

Checks for a form token in the request.

checkToken(string method = 'post') : bool
since

2.0.0

Arguments

method

stringThe request method in which to look for the token key.

Response

bool

clearHeaders

Method to clear any set response headers.

clearHeaders() : $this
inherited
since

2.0.0

Response

$this

close

Method to close the application.

close(int code) : void
inherited
since

2.0.0

Arguments

code

intThe exit code (optional; default is 0).

execute

Execute the application.

execute() : void
inherited
since

2.0.0

getBody

Return the body content

getBody() : mixed
inherited
since

2.0.0

Response

mixedThe response body as a string.

getFormToken

Method to determine a hash for anti-spoofing variable names

getFormToken(bool forceNew = false) : string
since

2.0.0

Arguments

forceNew

boolIf true, force a new token to be created

Response

stringHashed var name

getHeaders

Method to get the array of response headers to be sent when the response is sent to the client.

getHeaders() : array
inherited
since

2.0.0

Response

array

getInput

Method to get the application input object.

getInput() : \Joomla\Input\Input
inherited
since

2.0.0

Response

\Joomla\Input\Input

getResponse

Get the PSR-7 Response Object.

getResponse() : \Psr\Http\Message\ResponseInterface
inherited
since

2.0.0

Response

\Psr\Http\Message\ResponseInterface

getSession

Method to get the application session object.

getSession() : \Joomla\Session\SessionInterface
since

2.0.0

Response

\Joomla\Session\SessionInterfaceThe session object

isSslConnection

Determine if we are using a secure (SSL) connection.

isSslConnection() : bool
inherited
since

2.0.0

Response

boolTrue if using SSL, false if not.

isValidHttpStatus

Check if the value is a valid HTTP status code

isValidHttpStatus(int code) : bool
inherited
since

2.0.0

Arguments

code

intThe potential status code

Response

bool

prependBody

Prepend content to the body content

prependBody(string content) : $this
inherited
since

2.0.0

Arguments

content

stringThe content to prepend to the response body.

Response

$this

redirect

Redirect to another URL.

redirect(string url, int|bool status = 303) : void
inherited

If the headers have not been sent the redirect will be accomplished using a "301 Moved Permanently" or "303 See Other" code in the header pointing to the new location. If the headers have already been sent this will be accomplished using a JavaScript statement.

since

2.0.0

throws

\InvalidArgumentException

Arguments

url

stringThe URL to redirect to. Can only be http/https URL

status

int|boolThe HTTP status code to be provided. 303 is assumed by default.

sendHeaders

Send the response headers.

sendHeaders() : $this
inherited
since

2.0.0

Response

$this

setBody

Set body content. If body content already defined, this will replace it.

setBody(string content) : $this
inherited
since

2.0.0

Arguments

content

stringThe content to set as the response body.

Response

$this

setHeader

Method to set a response header.

setHeader(string name, string value, bool replace = false) : $this
inherited

If the replace flag is set then all headers with the given name will be replaced by the new one. The headers are stored in an internal array to be sent when the site is sent to the browser.

since

2.0.0

Arguments

name

stringThe name of the header to set.

value

stringThe value of the header to set.

replace

boolTrue to replace any headers with the same name.

Response

$this

setResponse

Set the PSR-7 Response Object.

setResponse(\Psr\Http\Message\ResponseInterface response) : void
inherited
since

2.0.0

Arguments

response

\Psr\Http\Message\ResponseInterfaceThe response object

setSession

Sets the session for the application to use, if required.

setSession(\Joomla\Session\SessionInterface session) : $this
since

2.0.0

Arguments

session

\Joomla\Session\SessionInterfaceA session object.

Response

$this