com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse方法的一些代码示例,展示了RPC.invokeAndEncodeResponse的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RPC.invokeAndEncodeResponse方法的具体详情如下:
包路径:com.google.gwt.user.server.rpc.RPC
类名称:RPC
方法名:invokeAndEncodeResponse

RPC.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.

This method does no security checking; security checking must be done on the method prior to this invocation.
[中]返回一个字符串,该字符串对调用服务方法的结果进行编码,可以是该方法返回的值,也可以是该方法引发的异常。
此方法不进行安全检查;在此调用之前,必须对该方法进行安全检查。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  AbstractSerializationStream.DEFAULT_FLAGS);

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * 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>
 * This method does no security checking; security checking must be done on
 * the method prior to this invocation.
 * </p>
 * 
 * @param target instance on which to invoke the serviceMethod
 * @param serviceMethod the method to invoke
 * @param args arguments used for the method invocation
 * @return a string which encodes either the method's return or a checked
 *         exception thrown by the method
 * 
 * @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 String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  throws SerializationException {
 return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

try {
 onAfterRequestDeserialized(rpcRequest);
 return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
   rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
   rpcRequest.getFlags());

代码示例来源:origin: net.wetheinter/gwt-user

return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  AbstractSerializationStream.DEFAULT_FLAGS);

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  AbstractSerializationStream.DEFAULT_FLAGS);

代码示例来源:origin: net.wetheinter/gwt-user

/**
 * 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>
 * This method does no security checking; security checking must be done on
 * the method prior to this invocation.
 * </p>
 * 
 * @param target instance on which to invoke the serviceMethod
 * @param serviceMethod the method to invoke
 * @param args arguments used for the method invocation
 * @return a string which encodes either the method's return or a checked
 *         exception thrown by the method
 * 
 * @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 String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  throws SerializationException {
 return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
}

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

/**
 * 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>
 * This method does no security checking; security checking must be done on
 * the method prior to this invocation.
 * </p>
 * 
 * @param target instance on which to invoke the serviceMethod
 * @param serviceMethod the method to invoke
 * @param args arguments used for the method invocation
 * @return a string which encodes either the method's return or a checked
 *         exception thrown by the method
 * 
 * @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 String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  throws SerializationException {
 return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@Override
  protected void processPost(HttpServletRequest request, HttpServletResponse response) throws Throwable {
    try {
      String requestPayload = this.readContent(request);
      RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, this.getClass(), this);

      String responsePayload =
        RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(), rpcRequest.getParameters(),
          rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());

      boolean gzipEncode =
        RPCServletUtils.acceptsGzipEncoding(request)
          && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);

      RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
    } catch (Exception e) {
      this.logger.error("Request processing failed", e);
      throw Throwables.propagate(e);
    }
  }
}

代码示例来源:origin: fr.putnami.pwt/pwt

@Override
  protected void processPost(HttpServletRequest request, HttpServletResponse response) throws Throwable {
    try {
      String requestPayload = this.readContent(request);
      RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, this.getClass(), this);

      String responsePayload =
        RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(), rpcRequest.getParameters(),
          rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());

      boolean gzipEncode =
        RPCServletUtils.acceptsGzipEncoding(request)
          && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);

      RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
    } catch (Exception e) {
      this.logger.error("Request processing failed", e);
      throw Throwables.propagate(e);
    }
  }
}

代码示例来源:origin: Putnami/putnami-web-toolkit

@RequestMapping(value = "/commandService", method = RequestMethod.POST)
public void processPostRpc(HttpServletRequest request, HttpServletResponse response)
  throws Throwable {
  try {
    String requestPayload = RPCServletUtils.readContentAsGwtRpc(request);
    RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, CommandService.class, this);
    String responsePayload =
      RPC.invokeAndEncodeResponse(commandService,
        rpcRequest.getMethod(), rpcRequest.getParameters(),
        rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
    boolean gzipEncode =
      RPCServletUtils.acceptsGzipEncoding(request)
        && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);
    RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
  } catch (Exception e) {
    this.logger.error("Request processing failed", e);
    throw Throwables.propagate(e);
  }
}

代码示例来源:origin: sk.seges.acris/acris-security-openid-core

@Override
public String processCall(String payload) throws SerializationException {
  try {
    RPCRequest req = RPC.decodeRequest(payload, null, this);
    RemoteService service = getServiceInstance(req.getMethod().getDeclaringClass());
    return RPC.invokeAndEncodeResponse(service, req.getMethod(), req.getParameters(),
        req.getSerializationPolicy(), req.getFlags());
  } catch (IncompatibleRemoteServiceException ex) {
    log("IncompatibleRemoteServiceException in the processCall(String) method.", ex);
    return RPC.encodeResponseForFailure(null, ex);
  }
}

代码示例来源:origin: org.appverse.web.framework.modules.backend.frontfacade.gwt/appverse-web-modules-backend-frontfacade-gwt

@Override
public String processCall(final String payload)
    throws SerializationException {
  try {
    Object presentationService = applicationContext.getBean(serviceName
        .get());
    if (!(presentationService instanceof RemoteService)) {
      throw new IllegalArgumentException(
          "Requested Spring Bean is not a GWT RemoteService Presentation Service: "
              + payload + " (" + presentationService + ")");
    }
    RPCRequest rpcRequest = RPC.decodeRequest(payload,
        presentationService.getClass(), this);
    if (presentationService instanceof AuthenticationServiceFacade
        && rpcRequest.getMethod().equals(
            AuthenticationServiceFacade.class
                .getMethod("getXSRFSessionToken"))) {
      return RPC.encodeResponseForSuccess(rpcRequest.getMethod(),
          SecurityHelper.createXSRFToken(getThreadLocalRequest()));
    }
    return RPC.invokeAndEncodeResponse(presentationService,
        rpcRequest.getMethod(), rpcRequest.getParameters(),
        rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
  } catch (Exception e) {
    GWTPresentationException pex = new GWTPresentationException(
        e.getMessage());
    return RPC.encodeResponseForFailure(null, pex);
  }
}

代码示例来源:origin: com.vaadin.external.atmosphere/atmosphere-gwt-poll

RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass(), this);
onAfterRequestDeserialized(rpcRequest);
return RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(),
    rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
    rpcRequest.getFlags());

代码示例来源:origin: net.wetheinter/gwt-user

try {
 onAfterRequestDeserialized(rpcRequest);
 return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
   rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
   rpcRequest.getFlags());

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

try {
 onAfterRequestDeserialized(rpcRequest);
 return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
   rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
   rpcRequest.getFlags());

相关文章