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
static

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

since

11.1

Arguments

$allow

booleanTrue to allow browser caching.

Response

booleanTrue if browser caching should be allowed

appendBody

Append content to the body content

appendBody(string $content) : void
static
since

11.1

Arguments

$content

stringThe content to append to the response body.

clearHeaders

Clear headers.

clearHeaders() : void
static
since

11.1

clientEncoding

Check, whether client supports compressed data

clientEncoding() : boolean
static
since

11.1

note

Replaces _clientEncoding method from 11.1

Response

boolean

compress

Compress the data

compress(string $data) : string
static

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

stringContent to compress for output.

Response

stringcompressed data

getBody

Return the body content

getBody(boolean $toArray = false) : string
static
since

11.1

Arguments

$toArray

booleanWhether or not to return the body content as an array of strings or as a single string; defaults to false.

Response

stringarray

getHeaders

Return array of headers.

getHeaders() : array
static
since

11.1

Response

array

prependBody

Prepend content to the body content

prependBody(string $content) : void
static
since

11.1

Arguments

$content

stringThe content to prepend to the response body.

sendHeaders

Send all headers.

sendHeaders() : void
static
since

11.1

setBody

Set body content.

setBody(string $content) : void
static

If body content already defined, this will replace it.

since

11.1

Arguments

$content

stringThe content to set to the response body.

setHeader

Set a header.

setHeader(string $name, string $value, boolean $replace = false) : void
static

If $replace is true, replaces any headers already defined with that $name.

since

11.1

Arguments

$name

stringThe name of the header to set.

$value

stringThe value of the header to set.

$replace

booleanTrue to replace any existing headers by name.

toString

Sends all headers prior to returning the string

toString(boolean $compress = false) : string
static
since

11.1

Arguments

$compress

booleanIf true, compress the data

Response

string

Properties

body

Body

static
since

11.1

Type(s)

array

cachable

Cachable

static
since

11.1

Type(s)

boolean

headers

Headers

static
since

11.1

Type(s)

array