return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy, AbstractSerializationStream.DEFAULT_FLAGS);
/** * 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()); }
try { onAfterRequestDeserialized(rpcRequest); return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy, AbstractSerializationStream.DEFAULT_FLAGS);
return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy, AbstractSerializationStream.DEFAULT_FLAGS);
/** * 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()); }
/** * 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()); }
@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); } } }
@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); } } }
@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); } }
@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); } }
@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); } }
RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass(), this); onAfterRequestDeserialized(rpcRequest); return RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
try { onAfterRequestDeserialized(rpcRequest); return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
try { onAfterRequestDeserialized(rpcRequest); return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(), rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());