Joomla! 1.5 API

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2011 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 Class JResponse

Description

JResponse Class

This class serves to provide the Joomla Framework with a common interface to access response variables. This includes header and body.

  • since: 1.5

Located in /joomla/environment/response.php (line 35)

Class JResponse   (Subpackage Environment)
Method Summary
Static method static boolean allowCache ([boolean $allow = null])
Method void appendBody (string $content)
Method void clearHeaders ()
Method string|array getBody ([boolean $toArray = false])
Method array getHeaders ()
Method void prependBody (string $content)
Method void sendHeaders ()
Method void setBody (string $content)
Method void setHeader (string $name, string $value, [boolean $replace = false])
Method string toString ([boolean $compress = false])
Method string _compress (string $data)
Methods
allowCache (line 47)

Set/get cachable state for the response

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

  • return: True of browser caching should be allowed
  • since: 1.5
boolean allowCache ([boolean $allow = null])
  • boolean $allow
appendBody (line 156)

Append content to the body content

  • access: public
void appendBody (string $content)
  • string $content
clearHeaders (line 101)

Clear headers

  • access: public
void clearHeaders ()
getBody (line 168)

Return the body content

  • access: public
string|array getBody ([boolean $toArray = false])
  • boolean $toArray: Whether or not to return the body content as an array of strings or as a single string; defaults to false
getHeaders (line 92)

Return array of headers;

  • access: public
array getHeaders ()
prependBody (line 146)

Prepend content to the body content

  • access: public
void prependBody (string $content)
  • string $content
sendHeaders (line 111)

Send all headers

  • access: public
void sendHeaders ()
setBody (line 136)

Set body content

If body content already defined, this will replace it.

  • access: public
void setBody (string $content)
  • string $content
setHeader (line 66)

Set a header

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

  • access: public
void setHeader (string $name, string $value, [boolean $replace = false])
  • string $name
  • string $value
  • boolean $replace
toString (line 188)

Sends all headers prior to returning the string

  • access: public
string toString ([boolean $compress = false])
  • boolean $compress: If true, compress the data
_compress (line 220)

Compress the data

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

  • return: compressed data
  • access: public
string _compress (string $data)
  • string $data: data
Support Joomla!