public function getContentIterator()
 {
     if ($this->contentIterator) {
         return $this->contentIterator;
     }
     return parent::getContentIterator();
 }
Example #2
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     // Build the content iterator first, in case it throws. Ideally, we'd
     // prefer to handle exceptions before we emit the response status or any
     // HTTP headers.
     $data = $response->getContentIterator();
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode(), $response->getHTTPResponseMessage());
     $this->writeHeaders($all_headers);
     $abort = false;
     foreach ($data as $block) {
         if (!$this->isWritable()) {
             $abort = true;
             break;
         }
         $this->writeData($block);
     }
     $response->didCompleteWrite($abort);
 }