00001 <?php 00025 require_once 'Zend/Json/Server/Response.php'; 00026 00033 class Zend_Json_Server_Response_Http extends Zend_Json_Server_Response 00034 { 00042 public function toJson() 00043 { 00044 $this->sendHeaders(); 00045 if (!$this->isError() && null === $this->getId()) { 00046 return ''; 00047 } 00048 00049 return parent::toJson(); 00050 } 00051 00061 public function sendHeaders() 00062 { 00063 if (headers_sent()) { 00064 return; 00065 } 00066 00067 if (!$this->isError() && (null === $this->getId())) { 00068 header('HTTP/1.1 204 No Content'); 00069 return; 00070 } 00071 00072 if (null === ($smd = $this->getServiceMap())) { 00073 return; 00074 } 00075 00076 $contentType = $smd->getContentType(); 00077 if (!empty($contentType)) { 00078 header('Content-Type: ' . $contentType); 00079 } 00080 } 00081 }