public function respond($expectedResponseTypeTag = NULL, $httpAccept = NULL, $cacheControl = NULL) { if ($this->expectedResponseTypeTag == NULL) { $this->expectedResponseTypeTag = $expectedResponseTypeTag; } $contentType = $this->getHttpMediaType($httpAccept); // Reply HTTP response code and headers. $httpResponseCode = $this->getHttpResponseCode(); HttpResponder::respond($httpResponseCode, $this->getResponseContentHttp(), $contentType); if (InternetMediaTypes::requiresEncoding($contentType)) { $this->characterEncoding = 'utf-8'; header("Content-type: {$contentType}; charset=" . $this->characterEncoding); } else { header("Content-type: {$contentType}"); } // Set cache-control header. if ($cacheControl != NULL) { header("Cache-Control: {$cacheControl}"); } else { // No caching! header("Cache-Control: no-cache, no-store, max-age=0"); header("Pragma: no-cache"); } // Reply the content. echo $this->getResponseContentHttp(); }