3 * THttpResponseAdatper class
5 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
6 * @link https://github.com/pradosoft/prado
7 * @copyright Copyright © 2005-2016 The PRADO Group
8 * @license https://github.com/pradosoft/prado/blob/master/COPYRIGHT
14 * THttpResponseAdapter class.
16 * THttpResponseAdapter allows the base http response class to change behavior
17 * without change the class hierarchy.
19 * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
24 class THttpResponseAdapter extends TApplicationComponent
27 * @var THttpResponse the response object the adapter is attached.
32 * Constructor. Attach a response to be adapted.
33 * @param THttpResponse the response object the adapter is to attach to.
35 public function __construct($response)
37 $this->_response=$response;
41 * @return THttpResponse the response object adapted.
43 public function getResponse()
45 return $this->_response;
49 * This method is invoked when the response flushes the content and headers.
50 * Default implementation calls the attached response flushContent method.
52 public function flushContent()
54 $this->_response->flushContent();
58 * This method is invoked when the response is to redirect to another page.
59 * @param string new url to redirect to.
61 public function httpRedirect($url)
63 $this->_response->httpRedirect($url);
67 * This method is invoked when a new HtmlWriter needs to be created.
68 * Default implementation calls the attached response createNewHtmlWriter method.
69 * @param string type of the HTML writer to be created.
70 * @param ITextWriter the writer responsible for holding the content.
72 public function createNewHtmlWriter($type, $writer)
74 return $this->_response->createNewHtmlWriter($type,$writer);