当前位置: 首页>>代码示例>>PHP>>正文


PHP RPC::encodeResponseForFailure方法代码示例

本文整理汇总了PHP中RPC::encodeResponseForFailure方法的典型用法代码示例。如果您正苦于以下问题:PHP RPC::encodeResponseForFailure方法的具体用法?PHP RPC::encodeResponseForFailure怎么用?PHP RPC::encodeResponseForFailure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RPC的用法示例。


在下文中一共展示了RPC::encodeResponseForFailure方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processCall

 /**
  * Process a call originating from the given request. Uses the
  * {@link RPC#invokeAndEncodeResponse(Object, java.lang.reflect.Method, Object[])}
  * method to do the actual work.
  * <p>
  * Subclasses may optionally override this method to handle the payload in any
  * way they desire (by routing the request to a framework component, for
  * instance). The {@link HttpServletRequest} and {@link HttpServletResponse}
  * can be accessed via the {@link #getThreadLocalRequest()} and
  * {@link #getThreadLocalResponse()} methods.
  * </p>
  * This is public so that it can be unit tested easily without HTTP.
  *
  * @param payload the UTF-8 request payload
  * @return a string which encodes either the method's return, a checked
  *         exception thrown by the method, or an
  *         {@link IncompatibleRemoteServiceException}
  * @throws SerializationException if we cannot serialize the response
  * @throws UnexpectedException if the invocation throws a checked exception
  *           that is not declared in the service method's signature
  * @throws RuntimeException if the service method throws an unchecked
  *           exception (the exception will be the one thrown by the service)
  */
 public function processCall($payload)
 {
     try {
         $this->logger->debug('Processing Call start', $this);
         $rpcRequest = RPC::decodeRequest($payload, $this->getMappedClassLoader(), $this);
         //FOCUS: this method is used only in PHP implementation of GWT RemoteServiceServlet
         $this->onAfterRequestDecoded($rpcRequest);
         $target = $this->getRPCTargetResolverStrategy()->resolveRPCTarget($rpcRequest->getMethod()->getDeclaringMappedClass());
         return RPC::invokeAndEncodeResponse($target, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getMappedClassLoader());
     } catch (IncompatibleRemoteServiceException $ex) {
         $this->logger->log(LoggerLevel::getLevelError(), 'An IncompatibleRemoteServiceException was thrown while processing this call.', $ex);
         return RPC::encodeResponseForFailure(null, $ex, null, $this->getMappedClassLoader());
     }
 }
开发者ID:guitarooman14,项目名称:hackazon,代码行数:37,代码来源:RemoteServiceServlet.class.php

示例2: invokeAndEncodeResponse

 /**
  * Returns a string that encodes the result of calling a service method, which
  * could be the value returned by the method or an exception thrown by it.
  *
  * <p>
  * If the serializationPolicy parameter is not <code>null</code>, it is
  * used to determine what types can be encoded as part of this response. If
  * this parameter is <code>null</code>, then only subtypes of
  * {@link com.google.gwt.user.client.rpc.IsSerializable IsSerializable} or
  * types which have custom field serializers may be encoded.
  * </p>
  *
  * <p>
  * This method does no security checking; security checking must be done on
  * the method prior to this invocation.
  * </p>
  *
  * @param Object $target instance on which to invoke the serviceMethod
  * @param MappedMethod $serviceMethod the method to invoke
  * @param array $args arguments used for the method invocation
  * @param SerializationPolicy $serializationPolicy determines the serialization policy to be used
  * @return strinta string which encodes either the method's return or a checked
  *         exception thrown by the method
  *
  * @throws NullPointerException if the serviceMethod or the
  *           serializationPolicy are <code>null</code>
  * @throws SecurityException if the method cannot be accessed or if the number
  *           or type of actual and formal arguments differ
  * @throws SerializationException if an object could not be serialized by the
  *           stream
  * @throws UnexpectedException if the serviceMethod throws a checked exception
  *           that is not declared in its signature
  */
 public static function invokeAndEncodeResponse($target, MappedMethod $serviceMethod, $args, SerializationPolicy $serializationPolicy, MappedClassLoader $mappedClassLoader)
 {
     //Object $target,
     //ReflectionMethod $serviceMethod, array $args,
     //SerializationPolicy $serializationPolicy
     if ($serviceMethod === null) {
         throw new NullPointerException("Not found matches serviceMethod (TIP: did you map your service method correctly?");
     }
     if ($serializationPolicy === null) {
         throw new NullPointerException("serializationPolicy");
     }
     /*String*/
     $responsePayload = '';
     try {
         /*Object*/
         $result = $serviceMethod->invoke($target, $args);
         $responsePayload = RPC::encodeResponseForSuccess($serviceMethod, $result, $serializationPolicy, $mappedClassLoader);
         //} catch (IllegalAccessException $xe) {
         //      SecurityException securityException = new SecurityException(
         //          formatIllegalAccessErrorMessage(target, serviceMethod));
         //      securityException.initCause(e);
         //      throw securityException;
         //    } catch (IllegalArgumentException e) {
         //      SecurityException securityException = new SecurityException(
         //          formatIllegalArgumentErrorMessage(target, serviceMethod, args));
         //      securityException.initCause(e);
         //      throw securityException;
     } catch (Exception $ex) {
         //      // Try to encode the caught exception
         //      //
         //      Throwable cause = e.getCause();
         //
         $responsePayload = RPC::encodeResponseForFailure($serviceMethod, $ex, $serializationPolicy, $mappedClassLoader);
     }
     return $responsePayload;
     //}
     //catch (Exception $ex) {
     //print_r($ex) ;
     //}
 }
开发者ID:rrsc,项目名称:freemed,代码行数:73,代码来源:RPC.class.php

示例3: processCall

 public function processCall($payload)
 {
     $this->checkPermutationStrongName();
     try {
         $rpcRequest = RPC::decodeRequest($payload, Classes::classOf($this->delegate), $this);
         $this->onAfterRequestDeserialized($rpcRequest);
         return RPC::invokeAndEncodeResponse($this->delegate, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getFlags());
     } catch (IncompatibleRemoteServiceException $ex) {
         echo $ex;
         /*log(
         	 "An IncompatibleRemoteServiceException was thrown while processing this call.",
         	 ex);
         	 */
         return RPC::encodeResponseForFailure(null, $ex);
     } catch (RpcTokenException $ex) {
         //log("An RpcTokenException was thrown while processing this call.",
         //tokenException);
         return RPC::encodeResponseForFailure(null, $ex);
     }
 }
开发者ID:google-code-backups,项目名称:gwtphp-derpc,代码行数:20,代码来源:RemoteServiceServlet.php

示例4: processCall

 /**
  * @param string $payload
  * @return string|null
  * @throws \IllegalArgumentException
  */
 public function processCall($payload)
 {
     try {
         $this->logger->debug('Processing Call start');
         /** @var \RPCRequest $rpcRequest */
         $rpcRequest = \RPC::decodeRequest($payload, $this->getMappedClassLoader(), $this);
         $this->onAfterRequestDecoded($rpcRequest);
         /** @var \RPCTargetResolverStrategy|Object $target */
         $target = $this->getRPCTargetResolverStrategy()->resolveRPCTarget($rpcRequest->getMethod()->getDeclaringMappedClass());
         $this->pixie->vulnService->goDown(preg_replace('/Impl$/', '', get_class($target)));
         $this->pixie->vulnService->goDown($rpcRequest->getMethod()->getName());
         if ($target instanceof IGWTService) {
             $target->setContext($this->pixie->vulnService->getConfig()->getCurrentContext());
             $target->setRequest($this->request);
         }
         return RPC::invokeAndEncodeResponse($target, $rpcRequest->getMethod(), $rpcRequest->getParameters(), $rpcRequest->getSerializationPolicy(), $rpcRequest->getMappedClassLoader());
     } catch (\IncompatibleRemoteServiceException $ex) {
         $this->logger->log(\LoggerLevel::getLevelError(), 'An IncompatibleRemoteServiceException was thrown while processing this call.', $ex);
         return \RPC::encodeResponseForFailure(null, $ex, null, $this->getMappedClassLoader());
     }
 }
开发者ID:brennantom,项目名称:hackazon,代码行数:26,代码来源:RemoteServiceServlet.php


注:本文中的RPC::encodeResponseForFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。