Class JApplicationWeb

Description

Base class for a Joomla! Web application.

  • since: 11.4

Located in /libraries/joomla/application/web.php (line 24)


	
			
Direct descendents
Class Description
JWeb Deprecated class placeholder. You should use JApplicationWeb instead.
Variable Summary
Method Summary
static JApplicationWeb getInstance ([string $name = null])
JApplicationWeb __construct ([JInput $input = null], [JRegistry $config = null], [JWebClient $client = null])
boolean allowCache ([boolean $allow = null])
JApplicationWeb appendBody (string $content)
boolean checkHeadersSent ()
void close ([integer $code = 0])
void compress ()
string detectRequestUri ()
void doExecute ()
void execute ()
mixed fetchConfigurationData ([string $file = ''], [string $class = 'JConfig'])
mixed get (string $key, [mixed $default = null])
mixed getBody ([boolean $asArray = false])
array getHeaders ()
void header (string $string, [boolean $replace = true], [integer $code = null])
JApplicationWeb initialise ([mixed $session = null], [mixed $document = null], [mixed $language = null], [mixed $dispatcher = null])
void loadDispatcher ()
void loadDocument ()
void loadLanguage ()
void loadSession ()
void loadSystemUris ([string $requestUri = null])
JApplicationWeb prependBody (string $content)
void redirect (string $url, [boolean $moved = false])
JApplicationWeb registerEvent (string $event, callback $handler)
void render ()
void respond ()
mixed set (string $key, [mixed $value = null])
JApplicationWeb setBody (string $content)
JApplicationWeb setHeader (string $name, string $value, [boolean $replace = false])
array triggerEvent (string $event, [array $args = null])
Variables
static JApplicationWeb $instance (line 96)
  • var: The application instance.
  • since: 11.3
  • access: protected
string $charSet = 'utf-8' (line 36)
  • var: Character encoding string.
  • since: 11.3
  • access: public
JWebClient $client (line 54)
  • var: The application client object.
  • since: 11.3
  • access: public
JRegistry $config (line 60)
  • var: The application configuration object.
  • since: 11.3
  • access: protected
JDispatcher $dispatcher (line 66)
  • var: The application dispatcher object.
  • since: 11.3
  • access: protected
JDocument $document (line 72)
  • var: The application document object.
  • since: 11.3
  • access: protected
JInput $input (line 30)
  • var: The application input object.
  • since: 11.3
  • access: public
JLanguage $language (line 78)
  • var: The application language object.
  • since: 11.3
  • access: protected
string $mimeType = 'text/html' (line 42)
  • var: Response mime type.
  • since: 11.3
  • access: public
JDate $modifiedDate (line 48)
  • var: The body modified date for response headers.
  • since: 11.3
  • access: public
object The $response (line 90)
  • var: application response object.
  • since: 11.3
  • access: protected
JSession $session (line 84)
  • var: The application session object.
  • since: 11.3
  • access: protected
Methods
static method getInstance (line 176)

Returns a reference to the global JApplicationWeb object, only creating it if it doesn't already exist.

This method must be invoked as: $web = JApplicationWeb::getInstance();

  • since: 11.3
  • access: public
static JApplicationWeb getInstance ([string $name = null])
  • string $name: The name (optional) of the JApplicationWeb class to instantiate.
Constructor __construct (line 113)

Class constructor.

  • since: 11.3
  • access: public
JApplicationWeb __construct ([JInput $input = null], [JRegistry $config = null], [JWebClient $client = null])
  • mixed $input: 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.
  • mixed $config: 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.
  • mixed $client: 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 (line 722)

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

  • since: 11.3
  • access: public
boolean allowCache ([boolean $allow = null])
  • boolean $allow: True to allow browser caching.
appendBody (line 868)

Append content to the body content

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb appendBody (string $content)
  • string $content: The content to append to the response body.
checkConnectionAlive (line 935)

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.

  • return: True if the connection is valid and normal.
  • see: connection_status()
  • since: 11.3
  • access: protected
boolean checkConnectionAlive ()
checkHeadersSent (line 950)

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.

  • return: True if the headers have already been sent.
  • see: headers_sent()
  • since: 11.3
  • access: protected
boolean checkHeadersSent ()
clearHeaders (line 792)

Method to clear any set response headers.

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb clearHeaders ()
close (line 610)

Exit the application.

  • since: 11.3
  • access: public
void close ([integer $code = 0])
  • integer $code: The exit code (optional; default is 0).
compress (line 398)

Checks the accept encoding of the browser and compresses the data before sending it to the client if possible.

  • since: 11.3
  • access: protected
void compress ()
detectRequestUri (line 962)

Method to detect the requested URI from server environment variables.

  • return: The requested URI
  • since: 11.3
  • access: protected
string detectRequestUri ()
doExecute (line 347)

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.

  • since: 11.3
  • access: protected
void doExecute ()
execute (line 297)

Execute the application.

  • since: 11.3
  • access: public
void execute ()
fetchConfigurationData (line 1018)

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.

  • return: Either an array or object to be loaded into the configuration object.
  • since: 11.3
  • access: protected
mixed fetchConfigurationData ([string $file = ''], [string $class = 'JConfig'])
  • string $file: The path and filename of the configuration file. If not provided, configuration.php in JPATH_BASE will be used.
  • string $class: The class name to instantiate.
get (line 689)

Returns a property of the object or the default value if the property is not set.

  • return: The value of the configuration.
  • since: 11.3
  • access: public
mixed get (string $key, [mixed $default = null])
  • string $key: The name of the property.
  • mixed $default: The default value (optional) if none is set.
getBody (line 884)

Return the body content

  • return: The response body either as an array or concatenated string.
  • since: 11.3
  • access: public
mixed getBody ([boolean $asArray = false])
  • boolean $asArray: True to return the body as an array of strings.
getDocument (line 896)

Method to get the application document object.

  • return: The document object
  • since: 11.3
  • access: public
JDocument getDocument ()
getHeaders (line 780)

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

  • since: 11.3
  • access: public
array getHeaders ()
getLanguage (line 908)

Method to get the application language object.

  • return: The language object
  • since: 11.3
  • access: public
JLanguage getLanguage ()
getSession (line 920)

Method to get the application session object.

  • return: The session object
  • since: 11.3
  • access: public
JSession getSession ()
header (line 1068)

Method to send a header to the client. We are wrapping this to isolate the header() function from our code base for testing reasons.

void header (string $string, [boolean $replace = true], [integer $code = null])
  • string $string: The header string.
  • boolean $replace: The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type.
  • integer $code: Forces the HTTP response code to the specified value. Note that this parameter only has an effect if the string is not empty.
initialise (line 225)

Initialise the application.

JApplicationWeb initialise ([mixed $session = null], [mixed $document = null], [mixed $language = null], [mixed $dispatcher = null])
  • mixed $session: 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.
  • mixed $document: 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.
  • mixed $language: 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.
  • mixed $dispatcher: 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.
loadConfiguration (line 624)

Load an object or array into the application configuration object.

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb loadConfiguration (mixed $data)
  • mixed $data: Either an array or object to be loaded into the configuration object.
loadDispatcher (line 1082)

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.

  • since: 11.3
  • access: protected
void loadDispatcher ()
loadDocument (line 1096)

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.

  • since: 11.3
  • access: protected
void loadDocument ()
loadLanguage (line 1110)

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.

  • since: 11.3
  • access: protected
void loadLanguage ()
loadSession (line 1124)

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.

  • since: 11.3
  • access: protected
void loadSession ()
loadSystemUris (line 1170)

Method to load the system URI strings for the application.

  • since: 11.3
  • access: protected
void loadSystemUris ([string $requestUri = null])
  • string $requestUri: An optional request URI to use instead of detecting one from the server environment variables.
prependBody (line 852)

Prepend content to the body content

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb prependBody (string $content)
  • string $content: The content to prepend to the response body.
redirect (line 514)

Redirect to another URL.

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
  • access: public
void redirect (string $url, [boolean $moved = false])
  • string $url: The URL to redirect to. Can only be http/https URL
  • boolean $moved: True if the page is 301 Permanently Moved, otherwise 303 See Other is assumed.
registerEvent (line 649)

Registers a handler to a particular event group.

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb registerEvent (string $event, callback $handler)
  • string $event: The event name.
  • callback $handler: The handler, a function or an instance of a event object.
render (line 361)

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.

  • since: 11.3
  • access: protected
void render ()
respond (line 468)

Method to send the application response to the client. All headers will be sent prior to the main application output data.

  • since: 11.3
  • access: protected
void respond ()
sendHeaders (line 806)

Send the response headers.

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb sendHeaders ()
set (line 704)

Modifies a property of the object, creating it if it does not already exist.

  • return: Previous value of the property
  • since: 11.3
  • access: public
mixed set (string $key, [mixed $value = null])
  • string $key: The name of the property.
  • mixed $value: The value of the property to set (optional).
setBody (line 836)

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

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb setBody (string $content)
  • string $content: The content to set as the response body.
setHeader (line 745)

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.

  • return: Instance of $this to allow chaining.
  • since: 11.3
  • access: public
JApplicationWeb setHeader (string $name, string $value, [boolean $replace = false])
  • string $name: The name of the header to set.
  • string $value: The value of the header to set.
  • boolean $replace: True to replace any headers with the same name.
triggerEvent (line 669)

Calls all handlers associated with an event group.

  • return: An array of results from each function call, or null if no dispatcher is defined.
  • since: 11.3
  • access: public
array triggerEvent (string $event, [array $args = null])
  • string $event: The event name.
  • array $args: An array of arguments (optional).

Documentation generated on Mon, 25 Jun 2012 14:01:30 -0500 by phpDocumentor 1.4.4