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


Java RPCRequest类代码示例

本文整理汇总了Java中com.google.gwt.user.server.rpc.RPCRequest的典型用法代码示例。如果您正苦于以下问题:Java RPCRequest类的具体用法?Java RPCRequest怎么用?Java RPCRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RPCRequest类属于com.google.gwt.user.server.rpc包,在下文中一共展示了RPCRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processCall

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
/**
 * This is taken from GWT 2.4 sources.  The changed code was to, rather than 
 * call the actual XxxxServer method that would have handled the request, 
 * simply encode an AccessDeniedException as the failure response for the request.
 * 
 * Revisions to newer GWT versions should verify that this code is still
 * suitable for those newer GWT versions.
 */
@Override
public String processCall(String payload) throws SerializationException {
    try {
        RPCRequest rpcRequest = RPC.decodeRequest(payload);
        onAfterRequestDeserialized(rpcRequest);
        // ******* CHANGED GWT 2.4 CODE STARTS
        LogFactory.getLog(GWTAccessDeniedHandlerImpl.class).warn("GWT Method: " 
                    + rpcRequest.getMethod().getName() + " Exception: " + e.getMessage());
        return RPC
                .encodeResponseForFailure(
                        rpcRequest.getMethod(),
                        new org.opendatakit.common.security.client.exception.AccessDeniedException(
                                e));
        // ******** CHANGED GWT 2.4 CODE ENDS
    } catch (IncompatibleRemoteServiceException ex) {
        LogFactory.getLog(GWTAccessDeniedHandlerImpl.class).warn("An IncompatibleRemoteServiceException was thrown while processing this call.",
                ex);
        return RPC.encodeResponseForFailure(null, ex);
    }
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:29,代码来源:GWTAccessDeniedHandlerImpl.java

示例2: createRPCException

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
protected RPCException createRPCException(Throwable e) {
    e.printStackTrace();
    RPCRequest req = (RPCRequest) ServerContext.getRequestOwner().getAttribute("rpcRequest");

   String userMsg = "";
   String msg = "";
   for (Throwable t= e.getCause(); (t!=null); t= t.getCause()) {
       if (t instanceof EndUserException) {
           userMsg= ((EndUserException)t).getEndUserMsg();
       }
       msg = t.getMessage();
   }

   RPCException rcpE= new RPCException (e, getClass().getSimpleName(),
                                    req.getMethod().getName(),
                                    "The call failed on the server",
                                    msg);
   rcpE.setEndUserMsg(userMsg);

    return rcpE;
}
 
开发者ID:lsst,项目名称:firefly,代码行数:22,代码来源:SearchServicesImpl.java

示例3: processPost

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的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

示例4: processPostRpc

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的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

示例5: processCall

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的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

示例6: parseGWTRPC

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
private static String parseGWTRPC( HttpMessage message, Value value, String charset )
	throws IOException
{
	RPCRequest request = RPC.decodeRequest( new String( message.content(), charset ) );
	String operationName = (String)request.getParameters()[0];
	joliex.gwt.client.Value requestValue = (joliex.gwt.client.Value)request.getParameters()[1];
	JolieGWTConverter.gwtToJolieValue( requestValue, value );
	return operationName;
}
 
开发者ID:jolie,项目名称:jolie,代码行数:10,代码来源:HttpProtocol.java

示例7: doUnexpectedFailure

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
protected void doUnexpectedFailure(Throwable e) {
    RPCRequest req = (RPCRequest) ServerContext.getRequestOwner().getAttribute("rpcRequest");
    if (req == null) {
        super.doUnexpectedFailure(e);
        return;
    }
    try {
        RPC.encodeResponseForFailure(req.getMethod(), e, req.getSerializationPolicy());
    } catch (Exception ex) {
        ex.printStackTrace();
        super.doUnexpectedFailure(ex);
    }
}
 
开发者ID:lsst,项目名称:firefly,代码行数:15,代码来源:BaseRemoteService.java

示例8: onAfterResponseSerialized

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
    protected void onAfterResponseSerialized(String serializedResponse) {
        RPCRequest req = (RPCRequest) ServerContext.getRequestOwner().getAttribute("rpcRequest");
        String id = makeReqKey(req);
        StopWatch.getInstance().printLog(id);
//        logger.briefDebug("processing " + id + "; " + serializedResponse.length() + " characters sent.");
    }
 
开发者ID:lsst,项目名称:firefly,代码行数:8,代码来源:BaseRemoteService.java

示例9: processCall

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的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

示例10: doFilter

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest req, ServletResponse resp,
		FilterChain chain) throws IOException, ServletException {
	HttpServletRequest request = (HttpServletRequest) req;
	if (request.getRequestURI().endsWith(".rpc")) {
		String requestURI = request.getRequestURI();
		String rpc = requestURI.substring(requestURI.lastIndexOf("/") + 1);
		Object delegate =webApplicationContext.getBean(rpc);
		if (delegate == null) {
			throw new AssertionError("RPC实例为null");
		}
		String payload = RPCServletUtils.readContent(request,
				"text/x-gwt-rpc", null);
		RPCRequest rpcRequest = RPC.decodeRequest(payload,
				delegate.getClass(), this);
		Method rpcRequestMethod = rpcRequest.getMethod();
		try {
			String responsePayload = RPC4Monitor.invokeAndEncodeResponse(delegate,
					rpcRequestMethod, rpcRequest.getParameters(),
					rpcRequest.getSerializationPolicy(),
					rpcRequest.getFlags());
			RPCServletUtils.writeResponse(null, (HttpServletResponse) resp,
					responsePayload, false);
		} catch (SerializationException e) {
			log.error(e);
			throw new RuntimeException("RPC序列化异常", e);
		}
	} else {
		chain.doFilter(req, resp);
	}
}
 
开发者ID:zogwei,项目名称:zeus3,代码行数:32,代码来源:RpcFilter.java

示例11: processCall

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的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

示例12: process

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
public void process(Method implMethod, RPCRequest rpcRequest) throws Exception {
    if (implMethod.isAnnotationPresent(RequiresSession.class)) {
        int sessionNumber = implMethod.getAnnotation(RequiresSession.class).sessionNumber();
        SessionFactory sessionFactory = HibernateUtil.getSessionFactory(sessionNumber);
        if (sessionFactory != null) {
            Session session = sessionFactory.openSession();
            session.beginTransaction();
            setSession(session);
        }
    }
}
 
开发者ID:rkfg,项目名称:gwtutil,代码行数:13,代码来源:SessionProcessor.java

示例13: doFilter

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
	public void doFilter(ServletRequest req, ServletResponse resp,
			FilterChain chain) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) req;
		
		if (request.getRequestURI().endsWith(".rpc")) {
			String remoteIP = request.getRemoteAddr();
			String requestURI = request.getRequestURI();
			
			String rpc = requestURI.substring(requestURI.lastIndexOf("/") + 1);
			Object delegate =webApplicationContext.getBean(rpc);
			if (delegate == null) {
				throw new AssertionError("RPC实例为null");
			}
			String payload = RPCServletUtils.readContent(request,
					"text/x-gwt-rpc", null);
			RPCRequest rpcRequest = RPC.decodeRequest(payload,
					delegate.getClass(), this);
			Method rpcRequestMethod = rpcRequest.getMethod();
			try {
				String responsePayload = RPC4Monitor.invokeAndEncodeResponse(delegate,
						rpcRequestMethod, rpcRequest.getParameters(),
						rpcRequest.getSerializationPolicy(),
						rpcRequest.getFlags());
				RPCServletUtils.writeResponse(null, (HttpServletResponse) resp,
						responsePayload, false);
				//**********add rpc logs**********
				/*SimpleDateFormat df=new SimpleDateFormat("HH");
				int currentHour = Integer.parseInt(df.format(new Date()));
				if(currentHour >= 9 && currentHour < 22){
					try{
						LogDescriptor logDescriptor = new LogDescriptor();
						logDescriptor.setLogType("rpc");
						logDescriptor.setIp(remoteIP);
						logDescriptor.setUserName(LoginUser.user.get().getUid());
						logDescriptor.setUrl(requestURI);
						logDescriptor.setRpc(rpc);
						logDescriptor.setDelegate(delegate.getClass().getSimpleName());
						logDescriptor.setMethod(rpcRequestMethod.getName());
						String description = "";
						if(rpcRequest.getParameters().length>0 && rpcRequest.getParameters()[0]!=null){
							description = rpcRequest.getParameters()[0].toString();
						}
						logDescriptor.setDescription(description);
						zeusLogManager.addLog(logDescriptor);
					}catch(Exception ex){
						log.error(ex);
					}
				}*/
				//*********************************
/*				System.out.println("user: "+LoginUser.user.get().getUid()+
						" | IP: "+remoteIP+
						" | url: "+requestURI+
						" | rpc: "+rpc+
						" | delegate: "+delegate.getClass().getSimpleName()+
						" | method: "+rpcRequestMethod.getName()+
						" | parameter: "+ (rpcRequest.getParameters().length>0 ? rpcRequest.getParameters()[0].toString() : ""));*/
			} catch (SerializationException e) {
				log.error(e);
				throw new RuntimeException("RPC序列化异常", e);
			}
		} else {
			chain.doFilter(req, resp);
		}
	}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:66,代码来源:RpcFilter.java

示例14: onBeforeRequestDeserialized

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
@Override
protected void onBeforeRequestDeserialized(String serializedRequest) {
    RPCRequest req = RPC.decodeRequest(serializedRequest, this.getClass(), this);
    ServerContext.getRequestOwner().setAttribute("rpcRequest", req);
    StopWatch.getInstance().start(makeReqKey(req));
}
 
开发者ID:lsst,项目名称:firefly,代码行数:7,代码来源:BaseRemoteService.java

示例15: createRPCException

import com.google.gwt.user.server.rpc.RPCRequest; //导入依赖的package包/类
protected RPCException createRPCException(Throwable e) {
    e.printStackTrace();
    RPCRequest req = (RPCRequest) ServerContext.getRequestOwner().getAttribute("rpcRequest");
    return new RPCException (e, getClass().getSimpleName(), req.getMethod().getName(), "The call failed on the server", e.getMessage());
}
 
开发者ID:lsst,项目名称:firefly,代码行数:6,代码来源:BaseRemoteService.java


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