Example #1
0
 /**
  * For all the success HTML responses unless its ajax, perform a redirect if the location
  * is set 
  * 
  * (non-PHPdoc)
  * @see LibBaseDispatcherResponseTransportAbstract::sendHeaders()
  */
 public function sendHeaders()
 {
     $response = $this->getResponse();
     $headers = $response->getHeaders();
     if (isset($headers['Location']) && $response->isSuccess() && !$response->getRequest()->isAjax()) {
         $response->setStatus(KHttpResponse::SEE_OTHER);
     }
     return parent::sendHeaders();
 }
Example #2
0
 /**
  * Send HTTP response.
  *
  * If not padding is set inspect the request query for a 'callback' parameter and use this.
  *
  * @see http://tools.ietf.org/html/rfc2616
  *
  * @return DispatcherResponseTransportJson
  */
 public function send()
 {
     //@TODO when returning the location header during
     //test it fetches the new location even though the
     //code is not redirect
     $this->getResponse()->setContentType('application/json');
     $headers = $this->getResponse()->getHeaders();
     if (isset($headers['Location'])) {
         $headers['Content-Location'] = $headers['Location'];
         unset($headers['Location']);
     }
     //If not padding is set inspect the request query.
     if (empty($this->_padding)) {
         $request = $this->getResponse()->getRequest();
         if ($request->has('callback')) {
             $this->setCallback($request->get('callback'));
         }
     }
     return parent::send();
 }