Thursday, November 1, 2012

rpc serialization without the rpc

Hi group folks!

I want to be able to retrieve RPC-serialized objects via HTTP GET. I don't really need a service based serialization mechanism but started with gwt-rpc before RequestFactory was around. At this point I'd prefer not to migrate to RequestFactory if I can avoid it because of existing custom field serializers, etc.

The reason I'm looking to retrieve objects via GET is because I want to set up a caching reverse proxy in front of my app. I would invalidate the cache when an object changes, which is very infrequently.

Is there a way to use ServerSerializationStreamWriter to serialize an object on the server outside the context of an RPC request? The object would be deserialized on the client via SerializationStreamReader.

I would like to use code on the server like this:
            SerializationStreamWriter writer = new ServerSerializationStreamWriter(getSerializationPolicy(moduleBaseUrl, strongName));
            writer.writeObject(configurator);

and code on the client like this:
            SerializationStreamFactory factory = (SerializationStreamFactory) GWT
                    .create(RemoteServiceImpl.class);
            SerializationStreamReader reader = factory.createStreamReader(response.getText());
            reader.readObject();

I figure I can send the client permutation strong name to the server, and then I should be able to retrieve the correct serialization policy file. I can use GWT.getPermutationStrongName() on the client for that, except when running in Dev Mode since it returns "HostedMode" instead of a strong name hash. I see that the payload of the RPC request when running in Dev Mode has a valid strong name. It appears that strong name is being set from generated code, and I haven't been able to find how it's being retrieved.

How can I get a valid permutation strong name when running in Dev Mode on the client?

Or is there a better way for me to use the RPC serialization (SerializationStreamWriter and SerializationStreamReader) to serialize a POJO on the server and deserialize on the client?

Thanks for any tips,
Peter

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/AmRhICIwzDgJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment