@Override
  public String processCall(String payload) throws SerializationException {
    try {
      String serviceName = extractServiceName(getThreadLocalRequest().getServletPath());
      Object service = applicationContext.getBean(serviceName);

      RPCRequest rpcRequest = RPC.decodeRequest(payload, service.getClass(), this);
      onAfterRequestDeserialized(rpcRequest);

      return RPC.invokeAndEncodeResponse(
          service,
          rpcRequest.getMethod(),
          rpcRequest.getParameters(),
          rpcRequest.getSerializationPolicy(),
          rpcRequest.getFlags());
    } catch (IncompatibleRemoteServiceException ex) {
      log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    }
  }
예제 #2
0
  @Override
  public String processCall(String content) throws SerializationException {
    try {
      // decode the request
      RPCRequest rpcRequest = RPC.decodeRequest(content, this.serviceClass);

      // if this is any service other than UserService we check session security here
      if (!(service instanceof UserService)) {
        validateSession(rpcRequest.getParameters());
      }
      // delegate work to the spring injected service
      return RPC.invokeAndEncodeResponse(
          service, rpcRequest.getMethod(), rpcRequest.getParameters());
    } catch (IncompatibleRemoteServiceException ex) {
      getServletContext()
          .log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    } catch (SessionTimedOutException ste) {
      return RPC.encodeResponseForFailure(null, ste);
    }
  }
예제 #3
0
  public String processCall(String payload) throws SerializationException {
    // First, check for possible XSRF situation
    checkPermutationStrongName();

    try {
      Object handler = getBean(getThreadLocalRequest());
      RPCRequest rpcRequest = RPC.decodeRequest(payload, handler.getClass(), this);
      onAfterRequestDeserialized(rpcRequest);
      return RPC.invokeAndEncodeResponse(
          handler,
          rpcRequest.getMethod(),
          rpcRequest.getParameters(),
          rpcRequest.getSerializationPolicy(),
          rpcRequest.getFlags());
    } catch (IncompatibleRemoteServiceException ex) {
      log("An IncompatibleRemoteServiceException was thrown while processing this call.", ex);
      return RPC.encodeResponseForFailure(null, ex);
    } catch (RpcTokenException tokenException) {
      log("An RpcTokenException was thrown while processing this call.", tokenException);
      return RPC.encodeResponseForFailure(null, tokenException);
    }
  }