Beispiel #1
0
 /**
  * Send response to the client.
  *
  * @param Response $response
  */
 protected function send(Response $response)
 {
     // Output HTTP header.
     $headersSent = headers_sent($file, $line);
     if (!$headersSent) {
         header("HTTP/1.1 {$response->getStatus()}", true, $response->getStatusCode());
         header("Content-Type: {$response->mimeType}; charset={$response->charset}");
         foreach ($response->getHeaders() as $key => $values) {
             $replace = true;
             foreach ($values as $value) {
                 header("{$key}: {$value}", $replace);
                 $replace = false;
             }
         }
     }
     if ($response instanceof JsonResponse) {
         header('Expires: Wed, 17 Aug 2005 00:00:00 GMT', true);
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT', true);
         header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false);
         header('Pragma: no-cache');
         // Output Gantry JSON response.
         echo $response;
         die;
     }
     return $response;
 }
Beispiel #2
0
 /**
  * Send response to the client.
  *
  * @param Response $response
  */
 protected function send(Response $response)
 {
     $app = \JFactory::getApplication();
     $document = \JFactory::getDocument();
     $document->setCharset($response->charset);
     $document->setMimeEncoding($response->mimeType);
     // Output HTTP header.
     $app->setHeader('Status', $response->getStatus());
     $app->setHeader('Content-Type', $response->mimeType . '; charset=' . $response->charset);
     foreach ($response->getHeaders() as $key => $values) {
         $replace = true;
         foreach ($values as $value) {
             $app->setHeader($key, $value, $replace);
             $replace = false;
         }
     }
     if ($response instanceof JsonResponse) {
         $app->setHeader('Expires', 'Wed, 17 Aug 2005 00:00:00 GMT', true);
         $app->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true);
         $app->setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', false);
         $app->setHeader('Pragma', 'no-cache');
         $app->sendHeaders();
     }
     // Output Gantry response.
     echo $response;
     if ($response instanceof JsonResponse) {
         $app->close();
     }
 }
Beispiel #3
0
 /**
  * Send response to the client.
  *
  * @param Response $response
  */
 protected function send(Response $response)
 {
     // Output HTTP header.
     header("HTTP/1.1 {$response->getStatus()}", true, $response->getStatusCode());
     header("Content-Type: {$response->mimeType}; charset={$response->charset}");
     foreach ($response->getHeaders() as $key => $values) {
         $replace = true;
         foreach ($values as $value) {
             header("{$key}: {$value}", $replace);
             $replace = false;
         }
     }
     if ($response instanceof JsonResponse) {
         // Output Gantry response.
         echo $response;
         die;
     }
     return $response;
 }
Beispiel #4
0
 /**
  * Send response to the client.
  *
  * @param Response $response
  */
 protected function send(Response $response)
 {
     $app = \JFactory::getApplication();
     $document = \JFactory::getDocument();
     $document->setCharset($response->charset);
     $document->setMimeEncoding($response->mimeType);
     // Output HTTP header.
     header("HTTP/1.1 {$response->getStatus()}", true, $response->getStatusCode());
     header("Content-Type: {$response->mimeType}; charset={$response->charset}");
     foreach ($response->getHeaders() as $key => $values) {
         $replace = true;
         foreach ($values as $value) {
             $app->setHeader($key, $value, $replace);
             $replace = false;
         }
     }
     // Output Gantry response.
     echo $response;
     if ($response instanceof JsonResponse) {
         // It is much faster and safer to exit now than to let Joomla to send the response.
         $app->sendHeaders();
         $app->close();
     }
 }
Beispiel #5
0
 protected function send(Response $response)
 {
     // Output HTTP header.
     header("HTTP/1.1 {$response->getStatus()}", true, $response->getStatusCode());
     header("Content-Type: {$response->mimeType}; charset={$response->charset}");
     foreach ($response->getHeaders() as $key => $values) {
         foreach ($values as $value) {
             header("{$key}: {$value}");
         }
     }
     echo $response;
     return true;
 }