Changeset 179
- Timestamp:
- 01/31/07 17:57:11 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ipo/response/stubBaseResponse.php
r142 r179 25 25 * @var array<string,string> 26 26 */ 27 protected $header = array();27 protected $headers = array(); 28 28 /** 29 29 * list of cookies for this response … … 31 31 * @var array<string,stubCookie> 32 32 */ 33 protected $cookie = array();33 protected $cookies = array(); 34 34 /** 35 35 * data to send as body of response … … 37 37 * @var string 38 38 */ 39 protected $data = null;39 protected $data = null; 40 40 41 41 /** … … 57 57 public function addHeader($name, $value) 58 58 { 59 $this->header[$name] = $value; 59 $this->headers[$name] = $value; 60 } 61 62 /** 63 * returns the list of headers 64 * 65 * @return array<string,string> 66 */ 67 public function getHeaders() 68 { 69 return $this->headers; 60 70 } 61 71 … … 67 77 public function setCookie(stubCookie $cookie) 68 78 { 69 $this->cookie[$cookie->getName()] = $cookie; 79 $this->cookies[$cookie->getName()] = $cookie; 80 } 81 82 /** 83 * returns the list of cookies 84 * 85 * @return array<stubCookie> 86 */ 87 public function getCookies() 88 { 89 return $this->cookies; 70 90 } 71 91 … … 81 101 82 102 /** 103 * returns the data written so far 104 * 105 * @return string 106 */ 107 public function getData() 108 { 109 return $this->data; 110 } 111 112 /** 113 * replaces the data written so far with the new data 114 * 115 * @param string $data 116 */ 117 public function replaceData($data) 118 { 119 $this->data = $data; 120 } 121 122 /** 83 123 * send the response out 84 124 */ … … 86 126 { 87 127 // send the headers 88 foreach ($this->header as $name => $value) {128 foreach ($this->headers as $name => $value) { 89 129 header($name . ': ' . $value); 90 130 } 91 131 92 132 // send the cookies 93 foreach ($this->cookie as $cookie) {133 foreach ($this->cookies as $cookie) { 94 134 setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiration(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); 95 135 } trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php
r142 r179 33 33 34 34 /** 35 * returns the list of headers 36 * 37 * @return array<string,string> 38 */ 39 public function getHeaders(); 40 41 /** 35 42 * add a cookie to the response 36 43 * … … 38 45 */ 39 46 public function setCookie(stubCookie $cookie); 47 48 /** 49 * returns the list of cookies 50 * 51 * @return array<stubCookie> 52 */ 53 public function getCookies(); 40 54 41 55 /** … … 47 61 48 62 /** 63 * returns the data written so far 64 * 65 * @return string 66 */ 67 public function getData(); 68 69 /** 70 * replaces the data written so far with the new data 71 * 72 * @param string $data 73 */ 74 public function replaceData($data); 75 76 /** 49 77 * send the response out 50 78 */
