Example #1
0
 /**
  * Builds a composite AMF response based on the response bodies inside the 
  * original AMF request.
  *
  * @return Zend_Amf_Response_Http
  */
 public function processResponseBodies()
 {
     $responseBodies = $this->request->getAmfBodies();
     foreach ($responseBodies as $body) {
         //Extract params from request body
         $return = $this->extractUriAndParams($body);
         //Create fake request object
         $liRequest = new Request(array('data' => $return['params']));
         //Assign URL to request based on details
         if (isset($return['source'])) {
             $liRequest->url = '/' . $return['source'] . '/' . $return['method'];
         } elseif (isset($return['targetURI'])) {
             $liRequest->url = '/' . $return['targetURI'];
         }
         //Assign request params
         $liRequest->params += $return['params'];
         //Dispatch the request normally, and get the controller data
         $controllerResponse = Dispatcher::run($liRequest);
         //Add on the response data (or error) to the current response
         if (isset($controllerResponse->body['error'])) {
             $netStatusEvent = new StdClass();
             $netStatusEvent->_explicitType = 'flex.messaging.messages.ErrorMessage';
             $netStatusEvent->faultString = $controllerResponse->body['error'];
             $newBody = new \Zend_Amf_Value_MessageBody($body->getResponseURI() . \Zend_AMF_Constants::STATUS_METHOD, null, $netStatusEvent);
             $this->response->addAmfBody($newBody);
         } else {
             $newBody = new \Zend_Amf_Value_MessageBody($body->getResponseURI() . \Zend_AMF_Constants::STATUS_METHOD, null, $controllerResponse->body);
             $this->response->addAmfBody($newBody);
         }
     }
     return $this->response;
 }
Example #2
0
 /**
  * Create the application response header for AMF and sends the serialized AMF string
  *
  * @return string
  */
 public function getResponse()
 {
     if (!headers_sent()) {
         header('Content-Type: application/x-amf');
     }
     return parent::getResponse();
 }
Example #3
0
 /**
  * Create the application response header for AMF and sends the serialized AMF string
  *
  * @return string
  */
 public function getResponse()
 {
     if (!headers_sent()) {
         header('Cache-Control: cache, must-revalidate');
         header('Pragma: public');
         header('Content-Type: application/x-amf');
     }
     return parent::getResponse();
 }
Example #4
0
 /**
  * Create the application response header for AMF and sends the serialized AMF string
  *
  * @return string
  */
 public function getResponse()
 {
     if (!headers_sent()) {
         header('Cache-Control: no-cache, must-revalidate');
         header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
         header('Pragma: no-cache');
         header('Content-Type: application/x-amf');
     }
     return parent::getResponse();
 }