Пример #1
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     // Do this first, in case it throws.
     $response_string = $response->buildResponseString();
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode(), $response->getHTTPResponseMessage());
     $this->writeHeaders($all_headers);
     $this->writeData($response_string);
 }
Пример #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);
 }
Пример #3
0
 /**
  * Write an entire @{class:AphrontResponse} to the output.
  *
  * @param AphrontResponse The response object to write.
  * @return void
  */
 public final function writeResponse(AphrontResponse $response)
 {
     $all_headers = array_merge($response->getHeaders(), $response->getCacheHeaders());
     $this->writeHTTPStatus($response->getHTTPResponseCode());
     $this->writeHeaders($all_headers);
     $this->writeData($response->buildResponseString());
 }