Implements interfaces:
THttpResponse class
THttpResponse implements the mechanism for sending output to client users.
To output a string to client, use write(). By default, the output is buffered until flush() is called or the application ends. The output in the buffer can also be cleaned by clear(). To disable output buffering, set BufferOutput property to false.
To send cookies to client, use getCookies(). To redirect client browser to a new URL, use redirect(). To send a file to client, use writeFile().
By default, THttpResponse is registered with TApplication as the response module. It can be accessed via TApplication::getResponse().
THttpResponse may be configured in application configuration file as follows
<module id="response" class="System.Web.THttpResponse" CacheExpire="20" CacheControl="nocache" BufferOutput="true" />
where CacheExpire, CacheControl and BufferOutput are optional properties of THttpResponse.
THttpResponse sends charset header if either Charset or TGlobalization.Charset is set.
Since 3.1.2, HTTP status code can be set with the StatusCode property.
Note: Some HTTP Status codes can require additional header or body information. So, if you use StatusCode in your application, be sure to add theses informations. E.g : to make an http authentication :
- public function clickAuth ($sender, $param)
- {
- $response=$this->getResponse();
- $response->setStatusCode(401);
- $response->appendHeader('WWW-Authenticate: Basic realm="Test"');
- }
This event handler will sent the 401 status code (Unauthorized) to the browser, with the WWW-Authenticate header field. This will force the browser to ask for a username and a password.
Located in /Web/THttpResponse.php (line 67)
TComponent | --TApplicationComponent | --TModule | --THttpResponse
Destructor.
Flushes any existing content in buffer.
Sends a cookie.
Do not call this method directly. Operate with the result of getCookies instead.
Sends a header.
Writes a log message into error log.
This method is simple wrapper of PHP function error_log.
Clears any existing buffered content.
Creates a new instance of HTML writer.
If the type of the HTML writer is not supplied, HtmlWriterType will be assumed.
Create a new html writer instance.
This method is used internally. Please use createHtmlWriter instead.
Flush the response contents and headers.
Outputs the buffered content, sends content-type and charset header.
This method is used internally. Please use flush instead.
Returns the content in the output buffer.
The buffer will NOT be cleared after calling this method. Use clear() is you want to clear the buffer.
Redirect the browser to another URL and exists the current application.
This method is used internally. Please use redirect instead.
Initializes the module.
This method is required by IModule and is invoked by application. It starts output buffer if it is enabled.
Redirects the browser to the specified URL.
The current application will be terminated after this method is invoked.
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).
Deletes a cookie.
Do not call this method directly. Operate with the result of getCookies instead.
Sends content type header if charset is not empty.
Send the HTTP header with the status code (defaults to 200) and status reason (defaults to OK)
Set the HTTP status code for the response.
Outputs a string.
It may not be sent back to user immediately if output buffer is enabled.
Sends a file back to user.
Make sure not to output anything else after calling this method.
Inherited From TModule
TModule::getID()
TModule::init()
TModule::setID()
Inherited From TApplicationComponent
TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()
Inherited From TComponent
TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Documentation generated on Mon, 21 Apr 2008 11:35:10 -0400 by phpDocumentor 1.3.0RC4