AbstractWebApplication
Extends AbstractApplication Implements WebApplicationInterfaceBase class for a Joomla! Web application.
| since |
1.0.0 |
|---|---|
| property-read Input |
The application input object |
| package |
Joomla Framework |
Methods
__construct
Class constructor.
__construct(\Joomla\Input\Input|null input = null, \Joomla\Registry\Registry|null config = null, \Joomla\Application\Web\WebClient|null client = null, \Psr\Http\Message\ResponseInterface|null response = null) :
| since |
1.0.0 |
|---|
Arguments
- input
Input|nullAn optional argument to provide dependency injection for the application's input object. If the argument is an Input object that object will become the application's input object, otherwise a default input object is created.- config
Registry|nullAn optional argument to provide dependency injection for the application's config object. If the argument is a Registry object that object will become the application's config object, otherwise a default config object is created.- client
WebClient|nullAn optional argument to provide dependency injection for the application's client object. If the argument is a Web\WebClient object that object will become the application's client object, otherwise a default client object is created.- response
ResponseInterface|nullAn optional argument to provide dependency injection for the application's response object. If the argument is a ResponseInterface object that object will become the application's response object, otherwise a default response object is created.
Response
mixed
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 |
1.0.0 |
|---|
Arguments
- allow
boolTrue to allow browser caching.
Response
bool
appendBody
Append content to the body content
appendBody( content) :
| since |
1.0.0 |
|---|
Arguments
- content
stringThe content to append to the response body.
Response
$this
checkConnectionAlive
Method to check the current client connection status to ensure that it is alive. We are wrapping this to isolate the \connection_status() function from our code base for testing reasons.
checkConnectionAlive() :
| see | connection_status() |
|---|---|
| since |
1.0.0 |
Response
boolTrue if the connection is valid and normal.
checkHeadersSent
Method to check to see if headers have already been sent.
checkHeadersSent() :
| see | headers_sent() |
|---|---|
| since |
1.0.0 |
Response
boolTrue if the headers have already been sent.
clearHeaders
Method to clear any set response headers.
clearHeaders() :
| since |
1.0.0 |
|---|
Response
$this
close
Method to close the application.
close( code) :
| since |
1.0.0 |
|---|
Arguments
- code
intThe exit code (optional; default is 0).
Response
void
compress
Checks the accept encoding of the browser and compresses the data before sending it to the client if possible.
compress() :
| since |
1.0.0 |
|---|
Response
void
detectRequestUri
Method to detect the requested URI from server environment variables.
detectRequestUri() :
| since |
1.0.0 |
|---|
Response
stringThe requested URI
dispatchEvent
Dispatches an application event if the dispatcher has been set.
dispatchEvent( eventName, \Joomla\Event\EventInterface|null event = null) : \Joomla\Event\EventInterface|null
| since |
2.0.0 |
|---|
Arguments
- eventName
stringThe event to dispatch.- event
EventInterface|nullThe event object.
Response
EventInterface|nullThe dispatched event or null if no dispatcher is set
doExecute
Method to run the application routines.
doExecute() :
Most likely you will want to instantiate a controller and execute it, or perform some sort of task directly.
| since |
1.0.0 |
|---|
Response
mixed
execute
Execute the application.
execute() :
| since |
1.0.0 |
|---|
Response
void
get
Returns a property of the object or the default value if the property is not set.
get( key, default = null) :
| since |
1.0.0 |
|---|
Arguments
- key
stringThe name of the property.- default
mixedThe default value (optional) if none is set.
Response
mixedThe value of the configuration.
getBody
Return the body content
getBody() :
| since |
1.0.0 |
|---|
Response
stringThe response body as a string.
getDispatcher
Get the event dispatcher.
getDispatcher() : \Joomla\Event\DispatcherInterface
| since |
1.2.0 |
|---|---|
| throws |
|
Response
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 |
1.0.0 |
|---|
Response
array<string|int, mixed>
getHttpStatusValue
Check if a given value can be successfully mapped to a valid http status value
getHttpStatusValue(string|int value) :
| since |
1.8.0 |
|---|
Arguments
- value
string|intThe given status as int or string
Response
string
getInput
Method to get the application input object.
getInput() : \Joomla\Input\Input
getLogger
Get the logger.
getLogger() : \Psr\Log\LoggerInterface
| since |
1.0.0 |
|---|
Response
LoggerInterface
getResponse
Get the PSR-7 Response Object.
getResponse() : \Psr\Http\Message\ResponseInterface
| since |
2.0.0 |
|---|
Response
ResponseInterface
header
Method to send a header to the client.
header( string, replace = true, code = null) :
| see | header() |
|---|---|
| since |
1.0.0 |
Arguments
- string
stringThe header string.- replace
boolThe optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.- code
intForces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.
Response
void
initialise
Custom initialisation method.
initialise() :
Called at the end of the AbstractApplication::__construct method. This is for developers to inject initialisation code for their application classes.
| since |
1.0.0 |
|---|
Response
void
isAscii
Tests whether a string contains only 7bit ASCII bytes.
isAscii( str) :
You might use this to conditionally check whether a string needs handling as UTF-8 or not, potentially offering performance benefits by using the native PHP equivalent if it's just ASCII e.g.;
| since |
1.4.0 |
|---|
Arguments
- str
stringThe string to test.
Response
boolTrue if the string is all ASCII
isRedirectState
Checks if a state is a redirect state
isRedirectState( state) :
| since |
1.8.0 |
|---|
Arguments
- state
intThe HTTP status code.
Response
bool
isSslConnection
Determine if we are using a secure (SSL) connection.
isSslConnection() :
| since |
1.0.0 |
|---|
Response
boolTrue if using SSL, false if not.
isValidHttpStatus
Check if the value is a valid HTTP status code
isValidHttpStatus( code) :
| since |
1.8.1 |
|---|
Arguments
- code
intThe potential status code
Response
bool
loadSystemUris
Method to load the system URI strings for the application.
loadSystemUris( requestUri = null) :
| since |
1.0.0 |
|---|
Arguments
- requestUri
stringAn optional request URI to use instead of detecting one from the server environment variables.
Response
void
prependBody
Prepend content to the body content
prependBody( content) :
| since |
1.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.
| throws |
|
|---|---|
| since |
1.0.0 |
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
respond
Method to send the application response to the client. All headers will be sent prior to the main application output data.
respond() :
| since |
1.0.0 |
|---|
Response
void
sendHeaders
Send the response headers.
sendHeaders() :
| since |
1.0.0 |
|---|
Response
$this
set
Modifies a property of the object, creating it if it does not already exist.
set( key, value = null) :
| since |
1.0.0 |
|---|
Arguments
- key
stringThe name of the property.- value
mixedThe value of the property to set (optional).
Response
mixedPrevious value of the property
setBody
Set body content. If body content already defined, this will replace it.
setBody( content) :
| since |
1.0.0 |
|---|
Arguments
- content
stringThe content to set as the response body.
Response
$this
setConfiguration
Sets the configuration for the application.
setConfiguration(\Joomla\Registry\Registry config) :
setDispatcher
Set the dispatcher to use.
setDispatcher(\Joomla\Event\DispatcherInterface dispatcher) :
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 |
1.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
Properties
charSet
Character encoding string.
| since |
1.0.0 |
|---|
Type(s)
string
mimeType
Response mime type.
| since |
1.0.0 |
|---|
Type(s)
string
httpVersion
HTTP protocol version.
| since |
1.9.0 |
|---|
Type(s)
string
modifiedDate
The body modified date for response headers.
| since |
1.0.0 |
|---|
Type(s)
DateTime
response
The application response object.
| since |
1.0.0 |
|---|
Type(s)
ResponseInterface
cacheable
Is caching enabled?
| since |
2.0.0 |
|---|
Type(s)
bool
responseMap
A map of integer HTTP response codes to the full HTTP Status for the headers.
| since |
1.6.0 |
|---|---|
| link |
Type(s)
array<string|int, mixed>