Exemplo n.º 1
0
 /**
  * Handles exception occured in dispatcher.
  * 
  * @param string $message    The error message.
  * @param string $statusCode The status code.
  * 
  * @return void
  */
 private static function _handleException($message, $statusCode)
 {
     header(ODataConstants::HTTPRESPONSE_HEADER_CONTENTTYPE . ':' . ODataConstants::MIME_TEXTPLAIN);
     $statusDescription = HttpStatus::getStatusDescription($statusCode);
     if (!is_null($statusDescription)) {
         $statusDescription = ' ' . $statusDescription;
     }
     header(ODataConstants::HTTPRESPONSE_HEADER_STATUS . ':' . $statusCode . $statusDescription);
     echo $message;
     exit;
 }
Exemplo n.º 2
0
 /**
  * Sets the value status code header on the response
  * 
  * @param string $value The status code
  * 
  * @return void
  */
 public function setResponseStatusCode($value)
 {
     $floor = floor($value / 100);
     if ($floor >= 1 && $floor <= 5) {
         $statusDescription = HttpStatus::getStatusDescription($value);
         if (!is_null($statusDescription)) {
             $statusDescription = ' ' . $statusDescription;
         }
         $this->_operationContext->outgoingResponse()->setStatusCode($value . $statusDescription);
     } else {
         ODataException::createInternalServerError('Invalid Status Code' . $value);
     }
 }