当前位置: 首页>>代码示例>>Java>>正文


Java RPC.invokeAndEncodeResponse方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:21,代码来源:BasicCommandService.java

示例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);
	}
}
 
开发者ID:Putnami,项目名称:putnami-web-toolkit,代码行数:23,代码来源:CommandController.java

示例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);
  }
}
 
开发者ID:DavidWhitlock,项目名称:PortlandStateJava,代码行数:17,代码来源:GuiceRemoteServiceServlet.java

示例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);
	}
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:31,代码来源:GwtRpcController.java

示例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);
  }
}
 
开发者ID:skidder,项目名称:mythpodcaster,代码行数:14,代码来源:GWTController.java


注:本文中的com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。