Class MOXMAN_Http_Response

InheritanceMOXMAN_Http_Response

This class wraps in the HTTP response in PHP and adds various methods for streaming files and contents to the client.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructs a HTTP response instance. MOXMAN_Http_Response
disableCache() Sets various headers for disabling the cache of the request. MOXMAN_Http_Response
redirect() Redirects the browser to the specified URL. MOXMAN_Http_Response
sendContent() Sends the specified contents to client unencoded. MOXMAN_Http_Response
sendFile() Sends the specified file to the client by streaming it. MOXMAN_Http_Response
sendHtml() Sends the specified contents HTML encoded. MOXMAN_Http_Response
sendJson() Sends the specified object as JSON. MOXMAN_Http_Response
sendLocalFile() Sends the specified local file to the client. MOXMAN_Http_Response
setHeader() Sets the specifed HTTP header. MOXMAN_Http_Response
setStatus() Sets the HTTP response code for example 404. MOXMAN_Http_Response

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
streamLocalFile() Loads the specified file and streams it to http response without setting any headers. This method is used by mockup classes to override the default behavior. MOXMAN_Http_Response

Method Details

__construct() public method

Constructs a HTTP response instance.

public void __construct ( )
disableCache() public method

Sets various headers for disabling the cache of the request.

public void disableCache ( )
redirect() public method

Redirects the browser to the specified URL.

public void redirect ( $url, $args false )
$url string

Url to redirect to.

$args Array

Query string arguments to pass to page.

sendContent() public method

Sends the specified contents to client unencoded.

public void sendContent ( $content )
$content string

Content to send to client.

sendFile() public method

Sends the specified file to the client by streaming it.

public void sendFile ( MOXMAN_Vfs_IFile $file, $download false )
$file MOXMAN_Vfs_IFile

File to stream to client.

$download Boolean

State if the file should be downloaded or not by the client.

sendHtml() public method

Sends the specified contents HTML encoded.

public void sendHtml ( $content )
$content string

Content to send to client HTML encoded.

sendJson() public method

Sends the specified object as JSON.

public void sendJson ( $obj )
$obj Mixed

Json data to send.

sendLocalFile() public method

Sends the specified local file to the client.

public void sendLocalFile ( $localPath, $download false )
$localPath string

Sets the local file to stream to client.

$download Boolean

True/false state if the file should be downloaded or not.

setHeader() public method

Sets the specifed HTTP header.

public void setHeader ( $name, $value, $replace true )
$name string

Name of the header to set.

$value string

Value to set to the header.

$replace Boolean

True/false state if the value should replace the default header.

setStatus() public method

Sets the HTTP response code for example 404.

public void setStatus ( $code, $message "" )
$code \number

Code to set.

$message string

Message to set.

streamLocalFile() protected method

Loads the specified file and streams it to http response without setting any headers. This method is used by mockup classes to override the default behavior.

protected void streamLocalFile ( $localPath )
$localPath string

Local path to send to client.