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

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

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

RPC.encodeResponse介绍

[英]Returns a string that encodes the results of an RPC call. Private overload that takes a flag signaling the preamble of the response payload.
[中]返回对RPC调用结果进行编码的字符串。私有重载,它使用一个标志来表示响应负载的前导。

代码示例

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

public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (cause == null) {
  throw new NullPointerException("cause cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
    + "' threw an unexpected exception: " + cause.toString(), cause);
 }
 return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
}

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

public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (serviceMethod == null) {
  throw new NullPointerException("serviceMethod cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 Class<?> methodReturnType = serviceMethod.getReturnType();
 if (methodReturnType != void.class && object != null) {
  Class<?> actualReturnType;
  if (methodReturnType.isPrimitive()) {
   actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  } else {
   actualReturnType = object.getClass();
  }
  if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
   throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
     + "' does not match the return type in the method's signature: '"
     + getSourceRepresentation(serviceMethod) + "'");
  }
 }
 return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
}

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

public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (cause == null) {
  throw new NullPointerException("cause cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
    + "' threw an unexpected exception: " + cause.toString(), cause);
 }
 return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
}

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

public static String encodeResponseForFailure(Method serviceMethod, Throwable cause,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (cause == null) {
  throw new NullPointerException("cause cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 if (serviceMethod != null && !RPCServletUtils.isExpectedException(serviceMethod, cause)) {
  throw new UnexpectedException("Service method '" + getSourceRepresentation(serviceMethod)
    + "' threw an unexpected exception: " + cause.toString(), cause);
 }
 return encodeResponse(cause.getClass(), cause, true, flags, serializationPolicy);
}

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

public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (serviceMethod == null) {
  throw new NullPointerException("serviceMethod cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 Class<?> methodReturnType = serviceMethod.getReturnType();
 if (methodReturnType != void.class && object != null) {
  Class<?> actualReturnType;
  if (methodReturnType.isPrimitive()) {
   actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  } else {
   actualReturnType = object.getClass();
  }
  if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
   throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
     + "' does not match the return type in the method's signature: '"
     + getSourceRepresentation(serviceMethod) + "'");
  }
 }
 return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
}

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

public static String encodeResponseForSuccess(Method serviceMethod, Object object,
  SerializationPolicy serializationPolicy, int flags) throws SerializationException {
 if (serviceMethod == null) {
  throw new NullPointerException("serviceMethod cannot be null");
 }
 if (serializationPolicy == null) {
  throw new NullPointerException("serializationPolicy");
 }
 Class<?> methodReturnType = serviceMethod.getReturnType();
 if (methodReturnType != void.class && object != null) {
  Class<?> actualReturnType;
  if (methodReturnType.isPrimitive()) {
   actualReturnType = getPrimitiveClassFromWrapper(object.getClass());
  } else {
   actualReturnType = object.getClass();
  }
  if (actualReturnType == null || !methodReturnType.isAssignableFrom(actualReturnType)) {
   throw new IllegalArgumentException("Type '" + printTypeName(object.getClass())
     + "' does not match the return type in the method's signature: '"
     + getSourceRepresentation(serviceMethod) + "'");
  }
 }
 return encodeResponse(methodReturnType, object, false, flags, serializationPolicy);
}

相关文章