本文整理汇总了Java中com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse方法的典型用法代码示例。如果您正苦于以下问题:Java RPC.invokeAndEncodeResponse方法的具体用法?Java RPC.invokeAndEncodeResponse怎么用?Java RPC.invokeAndEncodeResponse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.server.rpc.RPC
的用法示例。
在下文中一共展示了RPC.invokeAndEncodeResponse方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPost
import com.google.gwt.user.server.rpc.RPC; //导入方法依赖的package包/类
@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);
}
}
示例2: processPostRpc
import com.google.gwt.user.server.rpc.RPC; //导入方法依赖的package包/类
@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);
}
}
示例3: processCall
import com.google.gwt.user.server.rpc.RPC; //导入方法依赖的package包/类
@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());
} catch (IncompatibleRemoteServiceException ex) {
log("IncompatibleRemoteServiceException in the processCall(String) method.",
ex);
return RPC.encodeResponseForFailure(null, ex);
}
}
示例4: processCall
import com.google.gwt.user.server.rpc.RPC; //导入方法依赖的package包/类
@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);
}
}
示例5: processCall
import com.google.gwt.user.server.rpc.RPC; //导入方法依赖的package包/类
public String processCall(String payload) throws SerializationException {
try {
RPCRequest rpcRequest = RPC.decodeRequest(payload, this.remoteServiceClass);
return RPC.invokeAndEncodeResponse(this.remoteService, rpcRequest.getMethod(),
rpcRequest.getParameters());
} catch (IncompatibleRemoteServiceException ex) {
LOGGER.warn("An IncompatibleRemoteServiceException was thrown while processing this call.",
ex);
return RPC.encodeResponseForFailure(null, ex);
}
}