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

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

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

RPC.invokeAndEncodeResponse介绍

[英]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.

This method does no security checking; security checking must be done on the method prior to this invocation.
[中]返回一个字符串,该字符串对调用服务方法的结果进行编码,可以是该方法返回的值,也可以是该方法引发的异常。
此方法不进行安全检查;在此调用之前,必须对该方法进行安全检查。

代码示例

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

  1. return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  2. AbstractSerializationStream.DEFAULT_FLAGS);

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

  1. /**
  2. * Returns a string that encodes the result of calling a service method, which
  3. * could be the value returned by the method or an exception thrown by it.
  4. *
  5. * <p>
  6. * This method does no security checking; security checking must be done on
  7. * the method prior to this invocation.
  8. * </p>
  9. *
  10. * @param target instance on which to invoke the serviceMethod
  11. * @param serviceMethod the method to invoke
  12. * @param args arguments used for the method invocation
  13. * @return a string which encodes either the method's return or a checked
  14. * exception thrown by the method
  15. *
  16. * @throws SecurityException if the method cannot be accessed or if the number
  17. * or type of actual and formal arguments differ
  18. * @throws SerializationException if an object could not be serialized by the
  19. * stream
  20. * @throws UnexpectedException if the serviceMethod throws a checked exception
  21. * that is not declared in its signature
  22. */
  23. public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  24. throws SerializationException {
  25. return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
  26. }

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

  1. try {
  2. onAfterRequestDeserialized(rpcRequest);
  3. return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
  4. rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
  5. rpcRequest.getFlags());

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

  1. return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  2. AbstractSerializationStream.DEFAULT_FLAGS);

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

  1. return invokeAndEncodeResponse(target, serviceMethod, args, serializationPolicy,
  2. AbstractSerializationStream.DEFAULT_FLAGS);

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

  1. /**
  2. * Returns a string that encodes the result of calling a service method, which
  3. * could be the value returned by the method or an exception thrown by it.
  4. *
  5. * <p>
  6. * This method does no security checking; security checking must be done on
  7. * the method prior to this invocation.
  8. * </p>
  9. *
  10. * @param target instance on which to invoke the serviceMethod
  11. * @param serviceMethod the method to invoke
  12. * @param args arguments used for the method invocation
  13. * @return a string which encodes either the method's return or a checked
  14. * exception thrown by the method
  15. *
  16. * @throws SecurityException if the method cannot be accessed or if the number
  17. * or type of actual and formal arguments differ
  18. * @throws SerializationException if an object could not be serialized by the
  19. * stream
  20. * @throws UnexpectedException if the serviceMethod throws a checked exception
  21. * that is not declared in its signature
  22. */
  23. public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  24. throws SerializationException {
  25. return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
  26. }

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

  1. /**
  2. * Returns a string that encodes the result of calling a service method, which
  3. * could be the value returned by the method or an exception thrown by it.
  4. *
  5. * <p>
  6. * This method does no security checking; security checking must be done on
  7. * the method prior to this invocation.
  8. * </p>
  9. *
  10. * @param target instance on which to invoke the serviceMethod
  11. * @param serviceMethod the method to invoke
  12. * @param args arguments used for the method invocation
  13. * @return a string which encodes either the method's return or a checked
  14. * exception thrown by the method
  15. *
  16. * @throws SecurityException if the method cannot be accessed or if the number
  17. * or type of actual and formal arguments differ
  18. * @throws SerializationException if an object could not be serialized by the
  19. * stream
  20. * @throws UnexpectedException if the serviceMethod throws a checked exception
  21. * that is not declared in its signature
  22. */
  23. public static String invokeAndEncodeResponse(Object target, Method serviceMethod, Object[] args)
  24. throws SerializationException {
  25. return invokeAndEncodeResponse(target, serviceMethod, args, getDefaultSerializationPolicy());
  26. }

代码示例来源:origin: Putnami/putnami-web-toolkit

  1. @Override
  2. protected void processPost(HttpServletRequest request, HttpServletResponse response) throws Throwable {
  3. try {
  4. String requestPayload = this.readContent(request);
  5. RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, this.getClass(), this);
  6. String responsePayload =
  7. RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(), rpcRequest.getParameters(),
  8. rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
  9. boolean gzipEncode =
  10. RPCServletUtils.acceptsGzipEncoding(request)
  11. && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);
  12. RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
  13. } catch (Exception e) {
  14. this.logger.error("Request processing failed", e);
  15. throw Throwables.propagate(e);
  16. }
  17. }
  18. }

代码示例来源:origin: fr.putnami.pwt/pwt

  1. @Override
  2. protected void processPost(HttpServletRequest request, HttpServletResponse response) throws Throwable {
  3. try {
  4. String requestPayload = this.readContent(request);
  5. RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, this.getClass(), this);
  6. String responsePayload =
  7. RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(), rpcRequest.getParameters(),
  8. rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
  9. boolean gzipEncode =
  10. RPCServletUtils.acceptsGzipEncoding(request)
  11. && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);
  12. RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
  13. } catch (Exception e) {
  14. this.logger.error("Request processing failed", e);
  15. throw Throwables.propagate(e);
  16. }
  17. }
  18. }

代码示例来源:origin: Putnami/putnami-web-toolkit

  1. @RequestMapping(value = "/commandService", method = RequestMethod.POST)
  2. public void processPostRpc(HttpServletRequest request, HttpServletResponse response)
  3. throws Throwable {
  4. try {
  5. String requestPayload = RPCServletUtils.readContentAsGwtRpc(request);
  6. RPCRequest rpcRequest = RPC.decodeRequest(requestPayload, CommandService.class, this);
  7. String responsePayload =
  8. RPC.invokeAndEncodeResponse(commandService,
  9. rpcRequest.getMethod(), rpcRequest.getParameters(),
  10. rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
  11. boolean gzipEncode =
  12. RPCServletUtils.acceptsGzipEncoding(request)
  13. && RPCServletUtils.exceedsUncompressedContentLengthLimit(responsePayload);
  14. RPCServletUtils.writeResponse(null, response, responsePayload, gzipEncode);
  15. } catch (Exception e) {
  16. this.logger.error("Request processing failed", e);
  17. throw Throwables.propagate(e);
  18. }
  19. }

代码示例来源:origin: sk.seges.acris/acris-security-openid-core

  1. @Override
  2. public String processCall(String payload) throws SerializationException {
  3. try {
  4. RPCRequest req = RPC.decodeRequest(payload, null, this);
  5. RemoteService service = getServiceInstance(req.getMethod().getDeclaringClass());
  6. return RPC.invokeAndEncodeResponse(service, req.getMethod(), req.getParameters(),
  7. req.getSerializationPolicy(), req.getFlags());
  8. } catch (IncompatibleRemoteServiceException ex) {
  9. log("IncompatibleRemoteServiceException in the processCall(String) method.", ex);
  10. return RPC.encodeResponseForFailure(null, ex);
  11. }
  12. }

代码示例来源:origin: org.appverse.web.framework.modules.backend.frontfacade.gwt/appverse-web-modules-backend-frontfacade-gwt

  1. @Override
  2. public String processCall(final String payload)
  3. throws SerializationException {
  4. try {
  5. Object presentationService = applicationContext.getBean(serviceName
  6. .get());
  7. if (!(presentationService instanceof RemoteService)) {
  8. throw new IllegalArgumentException(
  9. "Requested Spring Bean is not a GWT RemoteService Presentation Service: "
  10. + payload + " (" + presentationService + ")");
  11. }
  12. RPCRequest rpcRequest = RPC.decodeRequest(payload,
  13. presentationService.getClass(), this);
  14. if (presentationService instanceof AuthenticationServiceFacade
  15. && rpcRequest.getMethod().equals(
  16. AuthenticationServiceFacade.class
  17. .getMethod("getXSRFSessionToken"))) {
  18. return RPC.encodeResponseForSuccess(rpcRequest.getMethod(),
  19. SecurityHelper.createXSRFToken(getThreadLocalRequest()));
  20. }
  21. return RPC.invokeAndEncodeResponse(presentationService,
  22. rpcRequest.getMethod(), rpcRequest.getParameters(),
  23. rpcRequest.getSerializationPolicy(), rpcRequest.getFlags());
  24. } catch (Exception e) {
  25. GWTPresentationException pex = new GWTPresentationException(
  26. e.getMessage());
  27. return RPC.encodeResponseForFailure(null, pex);
  28. }
  29. }

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

  1. RPCRequest rpcRequest = RPC.decodeRequest(payload, this.getClass(), this);
  2. onAfterRequestDeserialized(rpcRequest);
  3. return RPC.invokeAndEncodeResponse(this, rpcRequest.getMethod(),
  4. rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
  5. rpcRequest.getFlags());

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

  1. try {
  2. onAfterRequestDeserialized(rpcRequest);
  3. return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
  4. rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
  5. rpcRequest.getFlags());

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

  1. try {
  2. onAfterRequestDeserialized(rpcRequest);
  3. return RPC.invokeAndEncodeResponse(delegate, rpcRequest.getMethod(),
  4. rpcRequest.getParameters(), rpcRequest.getSerializationPolicy(),
  5. rpcRequest.getFlags());

相关文章