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

项目:ahome-core    文件:RpcUtil.java   
public static void prepareRpcService(ServiceDefTarget service,
        final String moduleUrl, final String relativeServiceUrl) {
    service.setServiceEntryPoint(moduleUrl + relativeServiceUrl);
    service.setRpcRequestBuilder(new RpcRequestBuilder() {
        @Override
        protected void doFinish(RequestBuilder rb) {
            super.doFinish(rb);
            rb.setHeader(MODULE_BASE_HEADER, moduleUrl);
        }
    });
}
项目:gwt-dispatch    文件:DispatchServiceDefault.java   
private void setRequestBuilderConfigurator(final RequestBuilderConfigurator requestBuilderConfigurator) {
    final RpcRequestBuilder customRpcRequestBuilder = new RpcRequestBuilder() {

        @Override
        protected RequestBuilder doCreate(final String serviceEntryPoint) {
            final RequestBuilder requestBuilder = super.doCreate(serviceEntryPoint);
            requestBuilderConfigurator.configureRequestBuilder(requestBuilder);
            return requestBuilder;
        }
    };
    ((ServiceDefTarget) rpcService).setRpcRequestBuilder(customRpcRequestBuilder);
}
项目:appinventor-extensions    文件:ExtendedServiceProxyGenerator.java   
/**
 * Generates a wrapper around the proxy generated by
 * {@link ServiceInterfaceProxyGenerator}.
 *
 * @param logger log interface
 * @param context generator context
 * @param typeName name of the interface that was passed to
 *        {@link com.google.gwt.core.client.GWT#create(Class)}
 * @param proxyTypeName the name of the wrapped proxy class
 * @return the name of the extended proxy class
 */
private String generateExtendedProxy(TreeLogger logger, GeneratorContext context,
    String typeName, String proxyTypeName) {
  JClassType type = context.getTypeOracle().findType(typeName);
  String packageName = type.getPackage().getName();
  String className = type.getSimpleSourceName() + PROXY_SUFFIX;
  String asyncName = typeName + ASYNC_SUFFIX;

  String classNameExtendedServiceProxy = "com.google.appinventor.client.ExtendedServiceProxy";

  // The generator can be invoked for the same class name more than once.
  // In this case the GeneratorContext.tryCreate method will return null to
  // indicate that the file already exists. This is not an error.
  PrintWriter out = context.tryCreate(logger, packageName, className);
  if (out != null) {
    out.println("package " + packageName + ";");
    out.println("class " + className);
    out.println("    extends " + classNameExtendedServiceProxy + "<" + typeName + ">");
    out.println("    implements " + ServiceDefTarget.class.getName() + ", " + asyncName + " {");
    out.println("  private " + proxyTypeName + " proxy = new " + proxyTypeName + "();");
    out.println("  public String getServiceEntryPoint() {");
    out.println("    return proxy.getServiceEntryPoint();");
    out.println("  }");
    out.println("  public void setRpcRequestBuilder(" + RpcRequestBuilder.class.getName() +
        " builder) {");
    out.println("    proxy.setRpcRequestBuilder(builder);");
    out.println("  }");
    out.println("  public void setServiceEntryPoint(String address) {");
    out.println("    proxy.setServiceEntryPoint(address);");
    out.println("  }");
    out.println("  public String getSerializationPolicyName() {");
    out.println("    return proxy.getSerializationPolicyName();");
    out.println("  }");

    for (JMethod method : type.getMethods()) {
      printMethod(out, method, typeName);
    }

    out.println("}");

    context.commit(logger, out);
  }

  return packageName + "." + className;
}
项目:geomajas-project-client-gwt2    文件:GwtCommandDispatcher.java   
/**
 * Set the RPC request builder that should be used with the RPC service.
 * 
 * @param builder
 * @since 2.4.0
 */
public void setRpcRequestBuilder(RpcRequestBuilder builder) {
    ((ServiceDefTarget) service).setRpcRequestBuilder(builder);
}