Changeset 714

Show
Ignore:
Timestamp:
06/05/07 22:47:20 (1 year ago)
Author:
schst
Message:

Flush the response,
whitespace fixes

Files:

Legend:

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

    r179 r714  
    44 * 
    55 * @author      Frank Kleine <mikey@stubbles.net> 
     6 * @author      Stephan Schmidt <schst@stubbles.net> 
    67 * @package     stubbles 
    78 * @subpackage  ipo_response 
     
    1011/** 
    1112 * Base class for a response to a request. 
    12  *  
     13 * 
    1314 * This class can be used for responses in web environments. It 
    1415 * collects all data of the response and is able to send it back 
     
    3435    /** 
    3536     * data to send as body of response 
    36      *  
     37     * 
    3738     * @var  string 
    3839     */ 
    3940    protected $data    = null; 
    40      
     41 
    4142    /** 
    4243     * clears the response 
     
    4849        $this->data   = null; 
    4950    } 
    50      
     51 
    5152    /** 
    5253     * add a header to the response 
     
    5960        $this->headers[$name] = $value; 
    6061    } 
    61      
     62 
    6263    /** 
    6364     * returns the list of headers 
     
    6970        return $this->headers; 
    7071    } 
    71      
     72 
    7273    /** 
    7374     * add a cookie to the response 
     
    7980        $this->cookies[$cookie->getName()] = $cookie; 
    8081    } 
    81      
     82 
    8283    /** 
    8384     * returns the list of cookies 
     
    8990        return $this->cookies; 
    9091    } 
    91      
     92 
    9293    /** 
    9394     * write data into the response 
     
    99100        $this->data .= $data; 
    100101    } 
    101      
     102 
    102103    /** 
    103104     * returns the data written so far 
    104      *  
     105     * 
    105106     * @return  string 
    106107     */ 
     
    109110        return $this->data; 
    110111    } 
    111      
     112 
    112113    /** 
    113114     * replaces the data written so far with the new data 
     
    119120        $this->data = $data; 
    120121    } 
    121      
     122 
    122123    /** 
    123124     * send the response out 
     
    129130            header($name . ': ' . $value); 
    130131        } 
    131          
     132 
    132133        // send the cookies 
    133134        foreach ($this->cookies as $cookie) { 
    134135            setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiration(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); 
    135136        } 
    136          
     137 
    137138        // and finally send the data 
    138139        echo $this->data; 
     140        flush(); 
    139141    } 
    140142}