gpt4 book ai didi

java - GWT - 相当于 "ServiceLayerDecorator.invoke(Method domainMethod, Object... args)"的 RPC

转载 作者:太空宇宙 更新时间:2023-11-04 06:36:14 27 4
gpt4 key购买 nike

对于请求工厂调用,我可以使用 ServiceLayerDecorator.invoke(Method domainMethod, Object... args) 来检查调用的每个方法,如果用户具有有效的 session 并且允许访问该方法。 RPC 调用的等效项是什么?

最佳答案

您可以重写 AbstractRemoteServiceServlet.onAfterRequestDeserialized(RPCRequest)

/**
* Override this method to examine the deserialized version of the request
* before the call to the servlet method is made. The default implementation
* does nothing and need not be called by subclasses.
*
* @param rpcRequest
*/
protected void onAfterRequestDeserialized(RPCRequest rpcRequest) {
}

用于您的 servlet。也许创建一个中央 MyBaseRemoteServiceServlet,您可以在其中重写该方法,然后从中派生所有远程服务 servlet。 RPCRequest 应包含您需要的所有信息,包括调用的方法及其参数。

关于java - GWT - 相当于 "ServiceLayerDecorator.invoke(Method domainMethod, Object... args)"的 RPC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25365542/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com