コード例 #1
0
 /**
  * This implementation of <code>process</code> performs the following steps:
  *
  * <ol>
  *     <li>Read the beginning of the message.</li>
  *     <li>Extract the service name from the message.</li>
  *     <li>Using the service name to locate the appropriate processor.</li>
  *     <li>Dispatch to the processor, with a decorated instance of TProtocol
  *         that allows readMessageBegin() to return the original Message.</li>
  * </ol>
  *
  * @throws TException If the message type is not CALL or ONEWAY, if
  * the service name was not found in the message, or if the service
  * name was not found in the service map.
  */
 public function process(TProtocol $input, TProtocol $output)
 {
     /*
         Use the actual underlying protocol (e.g. TBinaryProtocol) to read the
         message header. This pulls the message "off the wire", which we'll
         deal with at the end of this method.
     */
     $input->readMessageBegin($fname, $mtype, $rseqid);
     if ($mtype !== TMessageType::CALL && $mtype != TMessageType::ONEWAY) {
         throw new TException("This should not have happened!?");
     }
     // Extract the service name and the new Message name.
     if (strpos($fname, TMultiplexedProtocol::SEPARATOR) === false) {
         throw new TException("Service name not found in message name: {$fname}. Did you " . "forget to use a TMultiplexProtocol in your client?");
     }
     list($serviceName, $messageName) = explode(':', $fname, 2);
     if (!array_key_exists($serviceName, $this->serviceProcessorMap_)) {
         throw new TException("Service name not found: {$serviceName}.  Did you forget " . "to call registerProcessor()?");
     }
     // Dispatch processing to the stored processor
     $processor = $this->serviceProcessorMap_[$serviceName];
     return $processor->process(new StoredMessageProtocol($input, $messageName, $mtype, $rseqid), $output);
 }
コード例 #2
0
ファイル: TProtocolDecorator.php プロジェクト: angejia/thrift
 public function isBinaryAccelerated()
 {
     return $this->concreteProtocol_->isBinaryAccelerated();
 }
コード例 #3
0
ファイル: TBinaryProtocol.php プロジェクト: neonplay/thrift
 public function __construct($trans, $strictRead = false, $strictWrite = true)
 {
     parent::__construct($trans);
     $this->strictRead_ = $strictRead;
     $this->strictWrite_ = $strictWrite;
 }
コード例 #4
0
 public function readString(&$str)
 {
     return $this->concreteProtocol_->readString($str);
 }
コード例 #5
0
ファイル: TJSONProtocol.php プロジェクト: junerain/thrift
 public function __construct($trans)
 {
     parent::__construct($trans);
     $this->context_ = new BaseContext();
     $this->reader_ = new LookaheadReader($this);
 }
コード例 #6
0
 public function __construct($trans)
 {
     parent::__construct($trans);
 }
コード例 #7
0
 /**
  * Constructor
  */
 public function __construct($trans)
 {
     parent::__construct($trans);
     $this->writeContext_ = new Context();
 }