views:

236

answers:

2

Hi,

I am having a request 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 the gwt generates the md5 value of "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 ...

cheers

sven

A: 

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:

/*
 * Include the lengths of the contents components in the hash, so that the
 * hashed sequence of bytes is in a one-to-one correspondence with the
 * possible arguments to this method.
 */

From there, I tracked back to the linkers and then to PermutationResult which is feeding Util.computeStrongName via this function:

/**
 * The compiled JavaScript code as UTF8 bytes.
 */
byte[][] getJs();

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) and/or trunk/user/src/com/google/gwt/rpc

Igor Klimer
A: 

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.

Isaac Truett