JResponse
JResponse Class.
This class serves to provide the Joomla Platform with a common interface to access response variables. This includes header and body.
package |
Joomla.Platform |
---|---|
subpackage |
Environment |
since |
11.1 |
Methods
allowCache
Set/get cachable state for the response.
allowCache(boolean $allow = null) : boolean
If $allow is set, sets the cachable state of the response. Always returns current state.
since |
11.1 |
---|
Arguments
- $allow
boolean
True to allow browser caching.
Response
boolean
True if browser caching should be allowed
appendBody
Append content to the body content
appendBody(string $content) : void
since |
11.1 |
---|
Arguments
- $content
string
The content to append to the response body.
clearHeaders
Clear headers.
clearHeaders() : void
since |
11.1 |
---|
clientEncoding
Check, whether client supports compressed data
clientEncoding() : boolean
since |
11.1 |
---|---|
note |
Replaces _clientEncoding method from 11.1 |
Response
boolean
compress
Compress the data
compress(string $data) : string
Checks the accept encoding of the browser and compresses the data before sending it to the client.
note |
Replaces _compress method in 11.1 |
---|---|
since |
11.1 |
Arguments
- $data
string
Content to compress for output.
Response
string
compressed data
getBody
Return the body content
getBody(boolean $toArray = false) : string
since |
11.1 |
---|
Arguments
- $toArray
boolean
Whether or not to return the body content as an array of strings or as a single string; defaults to false.
Response
string
array
getHeaders
Return array of headers.
getHeaders() : array
since |
11.1 |
---|
Response
array
prependBody
Prepend content to the body content
prependBody(string $content) : void
since |
11.1 |
---|
Arguments
- $content
string
The content to prepend to the response body.
sendHeaders
Send all headers.
sendHeaders() : void
since |
11.1 |
---|
setBody
Set body content.
setBody(string $content) : void
If body content already defined, this will replace it.
since |
11.1 |
---|
Arguments
- $content
string
The content to set to the response body.
setHeader
Set a header.
setHeader(string $name, string $value, boolean $replace = false) : void
If $replace is true, replaces any headers already defined with that $name.
since |
11.1 |
---|
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 existing headers by name.
toString
Sends all headers prior to returning the string
toString(boolean $compress = false) : string
since |
11.1 |
---|
Arguments
- $compress
boolean
If true, compress the data
Response
string
Properties
body
Body
since |
11.1 |
---|
Type(s)
array
cachable
Cachable
since |
11.1 |
---|
Type(s)
boolean
headers
Headers
since |
11.1 |
---|
Type(s)
array