GWT 中的 post 令牌是如何生成的?
我有这样的请求:
5|0|7|http://localhost:8080/testproject/|29F4EA1240F157649C12466F01F46F60|com.test.client.GreetingService|greetServer|java.lang.String|myInput1|myInput2|1|2|3|4|2|5|5|6|7|
我想知道 GWT 如何生成 md5 值 29F4EA1240F157649C12466F01F46F60
?是基于客户端ip和日期吗?谁能指出我正确的代码吗?我只是找到了有关历史令牌的内容,但这对我来说看起来不同。
I have requests like
5|0|7|http://localhost:8080/testproject/|29F4EA1240F157649C12466F01F46F60|com.test.client.GreetingService|greetServer|java.lang.String|myInput1|myInput2|1|2|3|4|2|5|5|6|7|
I would like to know how GWT generates the md5 value 29F4EA1240F157649C12466F01F46F60
? Is it based on the client ip and date? Can anyone point me to the correct code? I just find stuff regarding the history token, but that looks different to me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,经过一番研究,我想我找到了答案。
您应该寻找的关键字是“strong name ”(或“strongName ”)和/或排列,因为看起来他们发送 RPC 请求的排列强名称(MD5 哈希),以便您可以在服务器端区分请求是发送的排列。
核心功能是
Util.computeStrongName
,它计算提供的字节数组的 MD5 哈希值 (d'oh),并添加了以下内容:从那里,我追溯到 链接器,然后排列结果< /a> 通过此函数提供
Util.computeStrongName
:呃,我希望这至少有点帮助;)如果这仍然不能回答你的问题(或者你正在寻找不同的东西) ),尝试
trunk/user/src/com/google/gwt/user/client/rpc
(从 RpcRequestBuilder.java)。OK, after some research I think I found the answer.
The keywords you should have been looking for are "strong name" (or "strongName") and/or permutation, since it seems that with the RPC request they send out the permuatation strong name (that MD5 hash), so that you can possibly distinguish on the server side from which permutation the request was send.
The core function is
Util.computeStrongName
, it computes an MD5 hash (d'oh) of the provided byte array, with the added catch:From there, I tracked back to the linkers and then to PermutationResult which is feeding
Util.computeStrongName
via this function:Eh, I hope that was at least a bit helpful ;) If this still doesn't answer your question (or you were looking for something different), try in
trunk/user/src/com/google/gwt/user/client/rpc
(start in RpcRequestBuilder.java).正如 Igor 所说,GWT 使用应用程序代码的 MD5 哈希值来为应用程序的每个版本的每个排列生成唯一的名称。您引用的特定哈希是 GWT RPC 请求负载的一部分,用于标识服务器上的 .gwt.rpc 序列化策略文件。该策略文件说明哪些 Java 对象可以序列化为 GWT RPC 服务中请求、响应或抛出异常的一部分。
As Igor said, GWT uses MD5 hashes of your application code to produce unique names for each permutation of each version of your application. The specific hash you referenced is a part of the GWT RPC request payload that identifies a .gwt.rpc serialization policy file on the server. That policy file says which Java objects can be serialized as part of the request, response, or thrown exceptions in the GWT RPC service.