JWeb
Extends \JApplicationWebDeprecated class placeholder. You should use JApplicationWeb instead.
package |
Joomla.Platform |
---|---|
subpackage |
Application |
since |
11.3 |
deprecated |
12.3 |
Methods
__construct
Class constructor.
__construct(mixed $input = null, mixed $config = null, mixed $client = null)
since |
11.3 |
---|
Arguments
- $input
mixed
An optional argument to provide dependency injection for the application's input object. If the argument is a JInput object that object will become the application's input object, otherwise a default input object is created.- $config
mixed
An optional argument to provide dependency injection for the application's config object. If the argument is a JRegistry object that object will become the application's config object, otherwise a default config object is created.- $client
mixed
An optional argument to provide dependency injection for the application's client object. If the argument is a JWebClient object that object will become the application's client object, otherwise a default client object is created.
allowCache
Set/get cachable state for the response. If $allow is set, sets the cachable state of the response. Always returns the current state.
allowCache(boolean $allow = null) : boolean
since |
11.3 |
---|
Arguments
- $allow
boolean
True to allow browser caching.
Response
boolean
appendBody
Append content to the body content
appendBody(string $content) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $content
string
The content to append to the response body.
Response
\JApplicationWeb
Instance of $this to allow chaining.
checkConnectionAlive
Method to check the current client connnection 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() : boolean
see | \connection_status() |
---|---|
since |
11.3 |
Response
boolean
True if the connection is valid and normal.
checkHeadersSent
Method to check to see if headers have already been sent. We are wrapping this to isolate the headers_sent() function from our code base for testing reasons.
checkHeadersSent() : boolean
see | \headers_sent() |
---|---|
since |
11.3 |
Response
boolean
True if the headers have already been sent.
clearHeaders
Method to clear any set response headers.
clearHeaders() : \JApplicationWeb
close
Exit the application.
close(integer $code) : void
since |
11.3 |
---|
Arguments
- $code
integer
The exit code (optional; default is 0).
compress
Checks the accept encoding of the browser and compresses the data before sending it to the client if possible.
compress() : void
since |
11.3 |
---|
detectRequestUri
Method to detect the requested URI from server environment variables.
detectRequestUri() : string
since |
11.3 |
---|
Response
string
The requested URI
doExecute
Method to run the Web application routines. Most likely you will want to instantiate a controller and execute it, or perform some sort of action that populates a JDocument object so that output can be rendered to the client.
doExecute() : void
since |
11.3 |
---|
execute
Execute the application.
execute() : void
since |
11.3 |
---|
fetchConfigurationData
Method to load a PHP configuration class file based on convention and return the instantiated data object. You will extend this method in child classes to provide configuration data from whatever data source is relevant for your specific application.
fetchConfigurationData(string $file = '', string $class = 'JConfig') : mixed
since |
11.3 |
---|
Arguments
- $file
string
The path and filename of the configuration file. If not provided, configuration.php in JPATH_BASE will be used.- $class
string
The class name to instantiate.
Response
mixed
Either an array or object to be loaded into the configuration object.
get
Returns a property of the object or the default value if the property is not set.
get(string $key, mixed $default = null) : mixed
since |
11.3 |
---|
Arguments
- $key
string
The name of the property.- $default
mixed
The default value (optional) if none is set.
Response
mixed
The value of the configuration.
getBody
Return the body content
getBody(boolean $asArray = false) : mixed
since |
11.3 |
---|
Arguments
- $asArray
boolean
True to return the body as an array of strings.
Response
mixed
The response body either as an array or concatenated string.
getDocument
Method to get the application document object.
getDocument() : \JDocument
getHeaders
Method to get the array of response headers to be sent when the response is sent to the client.
getHeaders() : array
since |
11.3 |
---|
Response
array
getInstance
Returns a reference to the global JApplicationWeb object, only creating it if it doesn't already exist.
getInstance(string $name = null) : \JApplicationWeb
This method must be invoked as: $web = JApplicationWeb::getInstance();
since |
11.3 |
---|
Arguments
- $name
string
The name (optional) of the JApplicationWeb class to instantiate.
Response
getLanguage
Method to get the application language object.
getLanguage() : \JLanguage
getSession
Method to get the application session object.
getSession() : \JSession
header
Method to send a header to the client. We are wrapping this to isolate the header() function from our code base for testing reasons.
header(string $string, boolean $replace = true, integer $code = null) : void
see | \JApplicationWeb::header() |
---|---|
since |
11.3 |
Arguments
- $string
string
The header string.- $replace
boolean
The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.- $code
integer
Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.
initialise
Initialise the application.
initialise(mixed $session = null, mixed $document = null, mixed $language = null, mixed $dispatcher = null) : \JApplicationWeb
see | \JApplicationWeb::loadSession() \JApplicationWeb::loadDocument() \JApplicationWeb::loadLanguage() \JApplicationWeb::loadDispatcher() |
---|---|
since |
11.3 |
Arguments
- $session
mixed
An optional argument to provide dependency injection for the application's session object. If the argument is a JSession object that object will become the application's session object, if it is false then there will be no session object, and if it is null then the default session object will be created based on the application's loadSession() method.- $document
mixed
An optional argument to provide dependency injection for the application's document object. If the argument is a JDocument object that object will become the application's document object, if it is false then there will be no document object, and if it is null then the default document object will be created based on the application's loadDocument() method.- $language
mixed
An optional argument to provide dependency injection for the application's language object. If the argument is a JLanguage object that object will become the application's language object, if it is false then there will be no language object, and if it is null then the default language object will be created based on the application's loadLanguage() method.- $dispatcher
mixed
An optional argument to provide dependency injection for the application's event dispatcher. If the argument is a JDispatcher object that object will become the application's event dispatcher, if it is null then the default event dispatcher will be created based on the application's loadDispatcher() method.
Response
\JApplicationWeb
Instance of $this to allow chaining.
loadConfiguration
Load an object or array into the application configuration object.
loadConfiguration(mixed $data) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $data
mixed
Either an array or object to be loaded into the configuration object.
Response
\JApplicationWeb
Instance of $this to allow chaining.
loadDispatcher
Method to create an event dispatcher for the Web application. The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create event dispatchers based on more specific needs.
loadDispatcher() : void
since |
11.3 |
---|
loadDocument
Method to create a document for the Web application. The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create document objects based on more specific needs.
loadDocument() : void
since |
11.3 |
---|
loadLanguage
Method to create a language for the Web application. The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create language objects based on more specific needs.
loadLanguage() : void
since |
11.3 |
---|
loadSession
Method to create a session for the Web application. The logic and options for creating this object are adequately generic for default cases but for many applications it will make sense to override this method and create session objects based on more specific needs.
loadSession() : void
since |
11.3 |
---|
loadSystemUris
Method to load the system URI strings for the application.
loadSystemUris(string $requestUri = null) : void
since |
11.3 |
---|
Arguments
- $requestUri
string
An optional request URI to use instead of detecting one from the server environment variables.
prependBody
Prepend content to the body content
prependBody(string $content) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $content
string
The content to prepend to the response body.
Response
\JApplicationWeb
Instance of $this to allow chaining.
redirect
Redirect to another URL.
redirect(string $url, boolean $moved = false) : void
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 |
11.3 |
---|
Arguments
- $url
string
The URL to redirect to. Can only be http/https URL- $moved
boolean
True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.
registerEvent
Registers a handler to a particular event group.
registerEvent(string $event, callback $handler) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $event
string
The event name.- $handler
callback
The handler, a function or an instance of a event object.
Response
\JApplicationWeb
Instance of $this to allow chaining.
render
Rendering is the process of pushing the document buffers into the template placeholders, retrieving data from the document and pushing it into the application response buffer.
render() : void
since |
11.3 |
---|
respond
Method to send the application response to the client. All headers will be sent prior to the main application output data.
respond() : void
since |
11.3 |
---|
sendHeaders
Send the response headers.
sendHeaders() : \JApplicationWeb
set
Modifies a property of the object, creating it if it does not already exist.
set(string $key, mixed $value = null) : mixed
since |
11.3 |
---|
Arguments
- $key
string
The name of the property.- $value
mixed
The value of the property to set (optional).
Response
mixed
Previous value of the property
setBody
Set body content. If body content already defined, this will replace it.
setBody(string $content) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $content
string
The content to set as the response body.
Response
\JApplicationWeb
Instance of $this to allow chaining.
setHeader
Method to set a response header. 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.
setHeader(string $name, string $value, boolean $replace = false) : \JApplicationWeb
since |
11.3 |
---|
Arguments
- $name
string
The name of the header to set.- $value
string
The value of the header to set.- $replace
boolean
True to replace any headers with the same name.
Response
\JApplicationWeb
Instance of $this to allow chaining.
triggerEvent
Calls all handlers associated with an event group.
triggerEvent(string $event, array $args = null) : array
since |
11.3 |
---|
Arguments
- $event
string
The event name.- $args
array
An array of arguments (optional).
Response
array
An array of results from each function call, or null if no dispatcher is defined.
Properties
charSet
Character encoding string.
since |
11.3 |
---|
Type(s)
string
mimeType
Response mime type.
since |
11.3 |
---|
Type(s)
string
response
The application response object.
since |
11.3 |
---|
Type(s)
object