Changeset 714
- Timestamp:
- 06/05/07 22:47:20 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/response/stubBaseResponse.php
r179 r714 4 4 * 5 5 * @author Frank Kleine <mikey@stubbles.net> 6 * @author Stephan Schmidt <schst@stubbles.net> 6 7 * @package stubbles 7 8 * @subpackage ipo_response … … 10 11 /** 11 12 * Base class for a response to a request. 12 * 13 * 13 14 * This class can be used for responses in web environments. It 14 15 * collects all data of the response and is able to send it back … … 34 35 /** 35 36 * data to send as body of response 36 * 37 * 37 38 * @var string 38 39 */ 39 40 protected $data = null; 40 41 41 42 /** 42 43 * clears the response … … 48 49 $this->data = null; 49 50 } 50 51 51 52 /** 52 53 * add a header to the response … … 59 60 $this->headers[$name] = $value; 60 61 } 61 62 62 63 /** 63 64 * returns the list of headers … … 69 70 return $this->headers; 70 71 } 71 72 72 73 /** 73 74 * add a cookie to the response … … 79 80 $this->cookies[$cookie->getName()] = $cookie; 80 81 } 81 82 82 83 /** 83 84 * returns the list of cookies … … 89 90 return $this->cookies; 90 91 } 91 92 92 93 /** 93 94 * write data into the response … … 99 100 $this->data .= $data; 100 101 } 101 102 102 103 /** 103 104 * returns the data written so far 104 * 105 * 105 106 * @return string 106 107 */ … … 109 110 return $this->data; 110 111 } 111 112 112 113 /** 113 114 * replaces the data written so far with the new data … … 119 120 $this->data = $data; 120 121 } 121 122 122 123 /** 123 124 * send the response out … … 129 130 header($name . ': ' . $value); 130 131 } 131 132 132 133 // send the cookies 133 134 foreach ($this->cookies as $cookie) { 134 135 setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiration(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); 135 136 } 136 137 137 138 // and finally send the data 138 139 echo $this->data; 140 flush(); 139 141 } 140 142 }
