Changeset 179

Show
Ignore:
Timestamp:
01/31/07 17:57:11 (2 years ago)
Author:
mikey
Message:

added some more methods to net.stubbles.ipo.response.stubResponse

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/net/stubbles/ipo/response/stubBaseResponse.php

    r142 r179  
    2525     * @var  array<string,string> 
    2626     */ 
    27     protected $header = array(); 
     27    protected $headers = array(); 
    2828    /** 
    2929     * list of cookies for this response 
     
    3131     * @var  array<string,stubCookie> 
    3232     */ 
    33     protected $cookie = array(); 
     33    protected $cookies = array(); 
    3434    /** 
    3535     * data to send as body of response 
     
    3737     * @var  string 
    3838     */ 
    39     protected $data   = null; 
     39    protected $data    = null; 
    4040     
    4141    /** 
     
    5757    public function addHeader($name, $value) 
    5858    { 
    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; 
    6070    } 
    6171     
     
    6777    public function setCookie(stubCookie $cookie) 
    6878    { 
    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; 
    7090    } 
    7191     
     
    81101     
    82102    /** 
     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    /** 
    83123     * send the response out 
    84124     */ 
     
    86126    { 
    87127        // send the headers 
    88         foreach ($this->header as $name => $value) { 
     128        foreach ($this->headers as $name => $value) { 
    89129            header($name . ': ' . $value); 
    90130        } 
    91131         
    92132        // send the cookies 
    93         foreach ($this->cookie as $cookie) { 
     133        foreach ($this->cookies as $cookie) { 
    94134            setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiration(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); 
    95135        } 
  • trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php

    r142 r179  
    3333     
    3434    /** 
     35     * returns the list of headers 
     36     * 
     37     * @return  array<string,string> 
     38     */ 
     39    public function getHeaders(); 
     40     
     41    /** 
    3542     * add a cookie to the response 
    3643     * 
     
    3845     */ 
    3946    public function setCookie(stubCookie $cookie); 
     47     
     48    /** 
     49     * returns the list of cookies 
     50     * 
     51     * @return  array<stubCookie> 
     52     */ 
     53    public function getCookies(); 
    4054     
    4155    /** 
     
    4761     
    4862    /** 
     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    /** 
    4977     * send the response out 
    5078     */