Java 类com.google.gwt.user.client.rpc.RpcToken 实例源码

项目:gwt-syncproxy    文件:SyncClientSerializationStreamWriter.java   
public SyncClientSerializationStreamWriter(Serializer serializer,
        String moduleBaseURL, String serializationPolicyStrongName,
        SerializationPolicy serializationPolicy, RpcToken rpcToken) {
    this.serializer = serializer;
    this.moduleBaseURL = moduleBaseURL;
    this.serializationPolicyStrongName = serializationPolicyStrongName;
    this.serializationPolicy = serializationPolicy;
    this.rpcToken = rpcToken;
    if (rpcToken != null) {
        addFlags(FLAG_RPC_TOKEN_INCLUDED);
    }
}
项目:gwt-syncproxy    文件:RemoteServiceInvocationHandler.java   
/**
 *
 * Handles method invocations to the {@link HasRpcToken} interface
 * implemented by the service. Also handles Annotation of service with
 * {@link RpcTokenImplementation}
 *
 * @throws ClassNotFoundException
 *             if base service interface class cannot be found if actual
 *             implemented interface is Async
 *
 * @since 0.5
 */
protected Object handleHasRpcToken(Object proxy, Method method,
        Object[] args) throws MethodNotSupportedException,
        NoSuchMethodException, ClassNotFoundException {
    if (HasRpcToken.class.getMethod("setRpcToken", RpcToken.class).equals(
            method)) {
        // Check if service has annotation defining the Token class and
        // that this token matches the specified class
        Class<?> srvcIntf = determineProxyServiceBaseInterface(proxy);
        if (srvcIntf != null) {
            RpcTokenImplementation rti = srvcIntf
                    .getAnnotation(RpcTokenImplementation.class);
            // Replace $ in class name in order to handle inner classes
            if (rti != null
                    && !args[0].getClass().getName().replace("$", ".")
                            .equals(rti.value())) {
                throw new RpcTokenException("Incorrect Token Class. Got "
                        + args[0].getClass().getName() + " but expected: "
                        + rti.value());
            }
        }

        this.token = (RpcToken) args[0];
        return null;
    } else if (HasRpcToken.class.getMethod("getRpcToken").equals(method)) {
        return this.token;
    } else if (HasRpcToken.class.getMethod("setRpcTokenExceptionHandler",
            RpcTokenExceptionHandler.class).equals(method)) {
        this.rpcTokenExceptionHandler = (RpcTokenExceptionHandler) args[0];
        return null;
    } else if (HasRpcToken.class.getMethod("setRpcTokenExceptionHandler",
            RpcTokenExceptionHandler.class).equals(method)) {
        return this.rpcTokenExceptionHandler;
    }
    throw new MethodNotSupportedException("Method: " + method.getName()
            + " in class: " + method.getDeclaringClass().getName()
            + " not defined for class: " + proxy.getClass().getName());
}
项目:OpenNMS    文件:EventService_Proxy.java   
@Override
protected void checkRpcTokenType(RpcToken token) {
  if (!(token instanceof com.google.gwt.user.client.rpc.XsrfToken)) {
    throw new RpcTokenException("Invalid RpcToken type: expected 'com.google.gwt.user.client.rpc.XsrfToken' but got '" + token.getClass() + "'");
  }
}
项目:OpenNMS    文件:LocationStatusService_Proxy.java   
@Override
protected void checkRpcTokenType(RpcToken token) {
  if (!(token instanceof com.google.gwt.user.client.rpc.XsrfToken)) {
    throw new RpcTokenException("Invalid RpcToken type: expected 'com.google.gwt.user.client.rpc.XsrfToken' but got '" + token.getClass() + "'");
  }
}
项目:OpenNMS    文件:SurveillanceService_Proxy.java   
@Override
protected void checkRpcTokenType(RpcToken token) {
  if (!(token instanceof com.google.gwt.user.client.rpc.XsrfToken)) {
    throw new RpcTokenException("Invalid RpcToken type: expected 'com.google.gwt.user.client.rpc.XsrfToken' but got '" + token.getClass() + "'");
  }
}
项目:OpenNMS    文件:AssetService_Proxy.java   
@Override
protected void checkRpcTokenType(RpcToken token) {
  if (!(token instanceof com.google.gwt.user.client.rpc.XsrfToken)) {
    throw new RpcTokenException("Invalid RpcToken type: expected 'com.google.gwt.user.client.rpc.XsrfToken' but got '" + token.getClass() + "'");
  }
}