WebApplicationInterface

Extends ApplicationInterface

Application sub-interface defining a web application class

since

2.0.0

package

Joomla Framework

Methods

allowCache

Set/get cacheable state for the response.

allowCache( allow = null) : 

If $allow is set, sets the cacheable 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( content) : 
since

2.0.0

Arguments

content

stringThe content to append to the response body.

Response

$this

clearHeaders

Method to clear any set response headers.

clearHeaders() : 
since

2.0.0

Response

$this

close

Method to close the application.

close( code) : 
inherited
since

2.0.0

Arguments

code

intThe exit code (optional; default is 0).

Response

void

execute

Execute the application.

execute() : 
inherited
since

2.0.0

Response

void

getBody

Return the body content

getBody() : 
since

2.0.0

Response

mixedThe response body as a string.

getHeaders

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

getHeaders() : mixed||string|int
since

2.0.0

Response

array<string|int, mixed>

getInput

Method to get the application input object.

getInput() : \Joomla\Input\Input
since

2.0.0

Response

Input

getResponse

Get the PSR-7 Response Object.

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

2.0.0

Response

ResponseInterface

isSslConnection

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

isSslConnection() : 
since

2.0.0

Response

boolTrue if using SSL, false if not.

isValidHttpStatus

Check if the value is a valid HTTP status code

isValidHttpStatus( code) : 
since

2.0.0

Arguments

code

intThe potential status code

Response

bool

prependBody

Prepend content to the body content

prependBody( content) : 
since

2.0.0

Arguments

content

stringThe content to prepend to the response body.

Response

$this

redirect

Redirect to another URL.

redirect( url,  status = 303) : 

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

intThe HTTP status code to be provided. 303 is assumed by default.

Response

void

sendHeaders

Send the response headers.

sendHeaders() : 
since

2.0.0

Response

$this

setBody

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

setBody( content) : 
since

2.0.0

Arguments

content

stringThe content to set as the response body.

Response

$this

setHeader

Method to set a response header.

setHeader( name,  value,  replace = false) : 

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) : 
since

2.0.0

Arguments

response

ResponseInterfaceThe response object

Response

void