Class MOXMAN_Http_Response
| Inheritance | MOXMAN_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
| Method | Description | Defined 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
| Method | Description | Defined 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
Constructs a HTTP response instance.
| public void __construct ( ) |
Sets various headers for disabling the cache of the request.
| public void disableCache ( ) |
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. |
Sends the specified contents to client unencoded.
| public void sendContent ( $content ) | ||
| $content | string | Content to send to client. |
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. |
Sends the specified contents HTML encoded.
| public void sendHtml ( $content ) | ||
| $content | string | Content to send to client HTML encoded. |
Sends the specified object as JSON.
| public void sendJson ( $obj ) | ||
| $obj | Mixed | Json data to send. |
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. |
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. |
Sets the HTTP response code for example 404.
| public void setStatus ( $code, $message = "" ) | ||
| $code | \number | Code to set. |
| $message | string | Message to set. |
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. |