我之前提出了一个问题,寻找在RPC调用(here)上构建内容的类。
现在,我找不到在ClientSerializationStreamWriter(here):类中调用以下方法的方法调用序列
@Override
public String toString() {
StringBuffer buffer = new StringBuffer();
writeHeader(buffer);
writeStringTable(buffer);
writePayload(buffer);
return buffer.toString();
}我注意到RemoteServiceProxy中使用了ClientSerializationStreamWriter,而且这个类是在RpcServiceProxy上扩展的。我试图找到的是在发送之前构建请求的确切位置。来自RemoteServiceProxy的方法doInvoke似乎负责分派请求本身,但是字符串requestData是如何构建的呢?
com.google.gwt.user.client.rpc.impl.RemoteServiceProxy.doInvoke我想要了解RPC请求在离开客户端web浏览器之前所做的常规路径。到目前为止,我不确定是否每个RPC都使用RpcServiceProxy。
我有很多假设,没有断言。
谢谢。
JuDaC
发布于 2010-11-04 21:48:01
了解有关调用堆栈的更多信息的最好方法可能是使用Java调试器(这在开发模式下是可能的-即使对于客户端代码也是如此!)
关于你的另一个问题:
到目前为止,我不确定是否每个
都使用RpcServiceProxy。
/com/google/gwt/rpc/RPC.gwt.xml (gwt-user.jar)为您的RemoteService指定延迟绑定:
<generate-with class="com.google.gwt.rpc.rebind.RpcServiceGenerator">
...
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService" />
...
</generate-with>RpcServiceGenerator:
protected ProxyCreator createProxyCreator(JClassType remoteService) {
return new RpcProxyCreator(remoteService);
}RpcProxyCreator:
protected Class<? extends RemoteServiceProxy> getProxySupertype() {
return RpcServiceProxy.class;
}发布于 2010-11-04 22:00:40
我找到了我问题的大概答案。在类ProxyCreator行中: 479。
String payloadName = nameFactory.createName("payload");
w.println("String " + payloadName + " = " + streamWriterName
+ ".toString();");在我的服务创建过程中
private final GreetingServiceAsync greetingService = GWT.create(GreetingService.class);GWT编译器动态生成RPC代理,此时GWT编译器注入代理方法(ProxyCreator.generateProxyMethod)。
com.google.gwt.user.rebind.rpc.ProxyCreator.generateProxyMethodHTH
https://stackoverflow.com/questions/4097065
复制相似问题