Hi all,
First off, I must say the newly available AutoBean framework is great. I've
recently used it to provide for JSON payloads for a service that batches
requests for both RPC and RequestFactory. We wanted to use JSON mainly so
that the request batches would be more discernible in tools like Firebug
than a GWT RPC payload full of other RPC and RequestFactory payloads.
The request AutoBean looks something like:
public interface Request {
String getRequestId();
String getRequestType();
Splittable getPayload();
// and setters...
}
The payload is a Splittable specifically so that RequestFactory payloads can
easily live as actual JSON within this JSON request envelope (to support the
goal of easier readability).
This works well enough, but is a little inefficient, because RequestFactory
payloads end up getting parsed twice. On the server-side,
SimpleRequestProcessor.process() and, likewise, on the client-side,
TransportReceiver.onTransportSuccess() each take in a String payload, which
means that the already parsed RequestFactory payload has to be encoded back
into a String and parsed again.
It seems that methods could be added to each relatively easily that take in
a Splittable payload in addition to the ones that take in a String,
since AutoBeanCodex.decode() will gladly accept either.
The only disadvantage I see is that this would add a dependency on AutoBean
to this part of the RequestFactory API, which I understand may be
a deal-breaker, even though other parts are already dependent (e.g.,
ProxyStore).
For now, I've reverted to sending the RequestFactory payload as a string in
the overall JSON payload (in the same way as RPC payloads), but it would be
great to see these changes so its actual JSON could be used directly
instead.
Thanks,
Kelsey Francis
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors