jResponseXml
extends jResponse
in package
XML response generator.
Tags
Table of Contents
- $checkValidity : bool
- if true, verify validity of the xml content, before to output it.
- $content : jTpl
- the template container.
- $contentTpl : string
- selector of the template file.
- $forcedHttpVersion : mixed
- $httpVersion : mixed
- $sendXMLHeader : bool
- say if the XML header have to be generated Usefull if the XML string to output already contain the XML header.
- $_charset : string
- The charset.
- $_httpHeaders : array<string|int, mixed>
- $_httpHeadersSent : bool
- $_httpStatusCode : string
- $_httpStatusMsg : string
- $_outputOnlyHeaders : bool
- $_type : string
- Id of the response.
- $_css : mixed
- $_xsl : mixed
- __construct() : mixed
- constructor.
- addCSSStyleSheet() : mixed
- to add a link to css stylesheet.
- addHttpHeader() : mixed
- add an http header to the response.
- addXSLStyleSheet() : mixed
- to add a link to an xsl stylesheet.
- cleanCacheHeaders() : mixed
- Clean the differents caches headers.
- clearHttpHeaders() : mixed
- delete all http headers.
- getFormatType() : string
- return the format type name (eg the family type name).
- getHttpHeaders() : mixed
- getType() : string
- return the response type name.
- isValidCache() : bool
- Use the HTTP headers Last-Modified to see if the resource in client cache is fresh.
- output() : bool
- generate the xml content and send it to the browser.
- outputErrors() : mixed
- output errors if any.
- setExpires() : mixed
- Set an expires header to the page/ressource.
- setHttpStatus() : mixed
- set the http status code for the http header.
- setLifetime() : mixed
- Set a life time for the page/ressource.
- _checkRequestType() : mixed
- check if the request is of type GET or HEAD.
- _normalizeDate() : string
- Normalize a date into GMT format.
- outputXmlHeader() : mixed
- output all processing instructions (stylesheet, xsl..) before the XML content.
- sendHttpHeaders() : mixed
- send http headers.
Properties
$checkValidity
if true, verify validity of the xml content, before to output it.
public
bool
$checkValidity
= alse
$content
the template container.
public
jTpl
$content
$contentTpl
selector of the template file.
public
string
$contentTpl
= ''
$forcedHttpVersion
public
mixed
$forcedHttpVersion
= alse
$httpVersion
public
mixed
$httpVersion
= '1.1'
$sendXMLHeader
say if the XML header have to be generated Usefull if the XML string to output already contain the XML header.
public
bool
$sendXMLHeader
= rue
Tags
$_charset
The charset.
protected
string
$_charset
$_httpHeaders
protected
array<string|int, mixed>
$_httpHeaders
= array()
list of http headers that will be send to the client
$_httpHeadersSent
protected
bool
$_httpHeadersSent
= alse
indicates if http headers have already been sent to the client
$_httpStatusCode
protected
string
$_httpStatusCode
= '200'
the http status code to send
$_httpStatusMsg
protected
string
$_httpStatusMsg
= 'OK'
the http status message to send
$_outputOnlyHeaders
protected
bool
$_outputOnlyHeaders
= alse
Should we output only the headers or the entire response
$_type
Id of the response.
protected
string
$_type
= 'xml'
$_css
private
mixed
$_css
= array()
$_xsl
private
mixed
$_xsl
= array()
Methods
__construct()
constructor.
public
__construct() : mixed
.
Return values
mixed —addCSSStyleSheet()
to add a link to css stylesheet.
public
addCSSStyleSheet(mixed $src[, mixed $params = array() ]) : mixed
Parameters
- $src : mixed
- $params : mixed = array()
Tags
Return values
mixed —addHttpHeader()
add an http header to the response.
public
addHttpHeader(string $htype, string $hcontent[, int $overwrite = true ]) : mixed
will be send during the output of the response.
Parameters
- $htype : string
-
the header type ("Content-Type", "Date-modified"...)
- $hcontent : string
-
value of the header type
- $overwrite : int = true
-
false or 0 if the value should be set only if it doesn't still exist -1 to add the header with the existing values true or 1 to replace the existing header
Return values
mixed —addXSLStyleSheet()
to add a link to an xsl stylesheet.
public
addXSLStyleSheet(mixed $src[, mixed $params = array() ]) : mixed
Parameters
- $src : mixed
- $params : mixed = array()
Tags
Return values
mixed —cleanCacheHeaders()
Clean the differents caches headers.
public
cleanCacheHeaders() : mixed
Return values
mixed —clearHttpHeaders()
delete all http headers.
public
clearHttpHeaders() : mixed
Return values
mixed —getFormatType()
return the format type name (eg the family type name).
public
getFormatType() : string
Return values
string —the name
getHttpHeaders()
public
getHttpHeaders() : mixed
Return values
mixed —getType()
return the response type name.
public
final getType() : string
Return values
string —the name
isValidCache()
Use the HTTP headers Last-Modified to see if the resource in client cache is fresh.
public
isValidCache([mixed $dateLastModified = null ][, null|mixed $etag = null ][, bool $cleanCacheHeader = true ]) : bool
Parameters
- $dateLastModified : mixed = null
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
- $etag : null|mixed = null
- $cleanCacheHeader : bool = true
-
True for clean/delete other cache headers. Default : true.
Return values
bool —True if the client resource version is fresh, false otherwise
output()
generate the xml content and send it to the browser.
public
final output() : bool
Tags
Return values
bool —true if ok
outputErrors()
output errors if any.
public
final outputErrors() : mixed
Return values
mixed —setExpires()
Set an expires header to the page/ressource.
public
setExpires(mixed $date[, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $date : mixed
- $cleanCacheHeader : mixed = true
Tags
Return values
mixed —setHttpStatus()
set the http status code for the http header.
public
setHttpStatus(string $code, string $msg) : mixed
Parameters
- $code : string
-
the status code (200, 404...)
- $msg : string
-
the message following the status code ("OK", "Not Found"..)
Return values
mixed —setLifetime()
Set a life time for the page/ressource.
public
setLifetime(int $time[, bool $sharedCache = false ][, mixed $cleanCacheHeader = true ]) : mixed
Parameters
- $time : int
-
Time during which the page will be cached. Express in seconds.
- $sharedCache : bool = false
-
True if the lifetime concern a public/shared cache. Default : false.
- $cleanCacheHeader : mixed = true
Return values
mixed —_checkRequestType()
check if the request is of type GET or HEAD.
protected
_checkRequestType() : mixed
Return values
mixed —_normalizeDate()
Normalize a date into GMT format.
protected
_normalizeDate(mixed $date) : string
Parameters
- $date : mixed
-
Can be a jDateTime object, a DateTime object or a string understandable by strtotime
Return values
string —a date in GMT format
outputXmlHeader()
output all processing instructions (stylesheet, xsl..) before the XML content.
protected
outputXmlHeader() : mixed
Return values
mixed —sendHttpHeaders()
send http headers.
protected
sendHttpHeaders() : mixed