diff options
author | emkael <emkael@tlen.pl> | 2016-02-24 23:18:07 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-02-24 23:18:07 +0100 |
commit | 6f7fdef0f500cd4bb540affd3bc1482243f337c1 (patch) | |
tree | 4853eecd0769a903e6130c1896e1d070848150dd /lib/prado/framework/Web/THttpResponseAdapter.php | |
parent | 61f2ea48a4e11cb5fb941b3783e19c9e9ef38a45 (diff) |
* Prado 3.3.0
Diffstat (limited to 'lib/prado/framework/Web/THttpResponseAdapter.php')
-rw-r--r-- | lib/prado/framework/Web/THttpResponseAdapter.php | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/prado/framework/Web/THttpResponseAdapter.php b/lib/prado/framework/Web/THttpResponseAdapter.php new file mode 100644 index 0000000..7f87590 --- /dev/null +++ b/lib/prado/framework/Web/THttpResponseAdapter.php @@ -0,0 +1,77 @@ +<?php +/** + * THttpResponseAdatper class + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @link https://github.com/pradosoft/prado + * @copyright Copyright © 2005-2015 The PRADO Group + * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT + * @version $Id$ + * @package System.Web + */ + +/** + * THttpResponseAdapter class. + * + * THttpResponseAdapter allows the base http response class to change behavior + * without change the class hierarchy. + * + * @author Wei Zhuo <weizhuo[at]gmail[dot]com> + * @version $Id$ + * @package System.Web + * @since 3.0 + */ +class THttpResponseAdapter extends TApplicationComponent +{ + /** + * @var THttpResponse the response object the adapter is attached. + */ + private $_response; + + /** + * Constructor. Attach a response to be adapted. + * @param THttpResponse the response object the adapter is to attach to. + */ + public function __construct($response) + { + $this->_response=$response; + } + + /** + * @return THttpResponse the response object adapted. + */ + public function getResponse() + { + return $this->_response; + } + + /** + * This method is invoked when the response flushes the content and headers. + * Default implementation calls the attached response flushContent method. + */ + public function flushContent() + { + $this->_response->flushContent(); + } + + /** + * This method is invoked when the response is to redirect to another page. + * @param string new url to redirect to. + */ + public function httpRedirect($url) + { + $this->_response->httpRedirect($url); + } + + /** + * This method is invoked when a new HtmlWriter needs to be created. + * Default implementation calls the attached response createNewHtmlWriter method. + * @param string type of the HTML writer to be created. + * @param ITextWriter the writer responsible for holding the content. + */ + public function createNewHtmlWriter($type, $writer) + { + return $this->_response->createNewHtmlWriter($type,$writer); + } +} + |