com.google.gwt.user.server.rpc.RPC Java Examples

The following examples show how to use com.google.gwt.user.server.rpc.RPC. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BasicCommandService.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
	}
}
 
Example #2
Source File: CommandController.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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);
	}
}
 
Example #3
Source File: ProcessorTest.java    From FreeBuilder with Apache License 2.0 4 votes vote down vote up
/**
 * Server-side deserialize does not match server-side serialize, so we can't test a round trip.
 */
public static <T> void gwtSerialize(T object) throws SerializationException {
  RPC.encodeResponseForSuccess(arbitraryVoidReturningMethod(), object);
}