[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Web/ -> THttpResponse.php (sommaire)

THttpResponse class

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: THttpResponse.php 1508 2006-11-25 20:42:54Z xue $
Poids: 432 lignes (12 kb)
Inclus ou requis: 1 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

THttpResponse:: (30 méthodes):
  __destruct()
  init()
  getCacheExpire()
  setCacheExpire()
  getCacheControl()
  setCacheControl()
  setContentType()
  getContentType()
  getCharset()
  setCharset()
  getBufferOutput()
  setBufferOutput()
  getStatusCode()
  setStatusCode()
  getCookies()
  write()
  writeFile()
  redirect()
  reload()
  flush()
  sendContentTypeHeader()
  getContents()
  clear()
  appendHeader()
  appendLog()
  addCookie()
  removeCookie()
  getHtmlWriterType()
  setHtmlWriterType()
  createHtmlWriter()


Classe: THttpResponse  - X-Ref

THttpResponse class

THttpResponse implements the mechanism for sending output to client users.

To output a string to client, use {@link write()}. By default, the output is
buffered until {@link flush()} is called or the application ends. The output in
the buffer can also be cleaned by {@link clear()}. To disable output buffering,
set BufferOutput property to false.

To send cookies to client, use {@link getCookies()}.
To redirect client browser to a new URL, use {@link redirect()}.
To send a file to client, use {@link writeFile()}.

By default, THttpResponse is registered with {@link TApplication} as the
response module. It can be accessed via {@link TApplication::getResponse()}.

THttpResponse may be configured in application configuration file as follows

<module id="response" CacheExpire="20" CacheControl="nocache" BufferOutput="true" />

where {@link getCacheExpire CacheExpire}, {@link getCacheControl CacheControl}
and {@link getBufferOutput BufferOutput} are optional properties of THttpResponse.

THttpResponse sends charset header if either {@link setCharset() Charset}
or {@link TGlobalization::setCharset() TGlobalization.Charset} is set.

__destruct()   X-Ref
Destructor.
Flushes any existing content in buffer.


init($config)   X-Ref
Initializes the module.
This method is required by IModule and is invoked by application.
It starts output buffer if it is enabled.

param: TXmlElement module configuration

getCacheExpire()   X-Ref

return: integer time-to-live for cached session pages in minutes, this has no effect for nocache limiter. Defaults to 180.

setCacheExpire($value)   X-Ref

param: integer time-to-live for cached session pages in minutes, this has no effect for nocache limiter.

getCacheControl()   X-Ref

return: string cache control method to use for session pages

setCacheControl($value)   X-Ref

param: string cache control method to use for session pages. Valid values

setContentType($type)   X-Ref

return: string content type, default is text/html

getContentType()   X-Ref

return: string current content type

getCharset()   X-Ref

return: string output charset.

setCharset($charset)   X-Ref

param: string output charset.

getBufferOutput()   X-Ref

return: boolean whether to enable output buffer

setBufferOutput($value)   X-Ref

param: boolean whether to enable output buffer

getStatusCode()   X-Ref

return: integer HTTP status code, defaults to 200

setStatusCode($status)   X-Ref

param: integer HTTP status code

getCookies()   X-Ref

return: THttpCookieCollection list of output cookies

write($str)   X-Ref
Outputs a string.
It may not be sent back to user immediately if output buffer is enabled.

param: string string to be output

writeFile($fileName,$content=null,$mimeType=null,$headers=null)   X-Ref
Sends a file back to user.
Make sure not to output anything else after calling this method.

param: string file name
param: string content to be set. If null, the content will be read from the server file pointed to by $fileName.
param: string mime type of the content.
param: array list of headers to be sent

redirect($url)   X-Ref
Redirects the browser to the specified URL.
The current application will be terminated after this method is invoked.

param: string URL to be redirected to. If the URL is a relative one, the base URL of

reload()   X-Ref
Reloads the current page.
The effect of this method call is the same as user pressing the
refresh button on his browser (without post data).


flush()   X-Ref
Outputs the buffered content, sends content-type and charset header.


sendContentTypeHeader()   X-Ref
Sends content type header if charset is not empty.


getContents()   X-Ref
Returns the content in the output buffer.
The buffer will NOT be cleared after calling this method.
Use {@link clear()} is you want to clear the buffer.

return: string output that is in the buffer.

clear()   X-Ref
Clears any existing buffered content.


appendHeader($value)   X-Ref
Sends a header.

param: string header

appendLog($message,$messageType=0,$destination='',$extraHeaders='')   X-Ref
Writes a log message into error log.
This method is simple wrapper of PHP function error_log.

param: string The error message that should be logged
param: integer where the error should go
param: string The destination. Its meaning depends on the message parameter as described above
param: string The extra headers. It's used when the message parameter is set to 1. This message type uses the same internal function as mail() does.

addCookie($cookie)   X-Ref
Sends a cookie.
Do not call this method directly. Operate with the result of {@link getCookies} instead.

param: THttpCookie cook to be sent

removeCookie($cookie)   X-Ref
Deletes a cookie.
Do not call this method directly. Operate with the result of {@link getCookies} instead.

param: THttpCookie cook to be deleted

getHtmlWriterType()   X-Ref

return: string the type of HTML writer to be used, defaults to THtmlWriter

setHtmlWriterType($value)   X-Ref

param: string the type of HTML writer to be used, may be the class name or the namespace

createHtmlWriter($type=null)   X-Ref
Creates a new instance of HTML writer.
If the type of the HTML writer is not supplied, {@link getHtmlWriterType HtmlWriterType} will be assumed.

param: string type of the HTML writer to be created. If null, {@link getHtmlWriterType HtmlWriterType} will be assumed.



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7