I followed this example.  And the simple answer to your question is to
copy the rpc file to a simple name under your classpath.  e.g.
myservice.rpc

http://www.techhui.com/profiles/blogs/simpler-and-speedier-gwt-with

So long if you don't change the class names of the objects which pass
through rpc, you can keep that file unchanged even if you recompile
and generate a different rpc file.


On Aug 4, 8:52 pm, Troels Nørgaard <troels.n.niel...@gmail.com> wrote:
> Hello all!
>
> I'm working on a project where a need to serialize objects for the
> client without using RPC/RemoteService.
> My code works fine for standard objects when using
> String encoded = RPC.encodeResponseForSuccess(method, bundle);
> (default serializing policy)
>
> or when loading my service's custom serializing policy by:
>
> SerializationPolicyLoader.getSerializationPolicyFileName(path + name);
>
> But it only works when I know the name of the gwt.rpc serializing
> policy file. I would very much like a solution where I could read the
> CRC string (strongName) of the current policy used by RPC's
> ServerSerializingStreamReader. But as it seems, the GWT team has gone
> through extend lengths to ensure this is not possible, and I can only
> come as close as:
> com.google.gwt.user.server.rpc.RPC:252:
> SerializationPolicy serializationPolicy =
> streamReader.getSerializationPolicy();
>
> So I end up with something like this:
>
> Method targetMethod = MyService.class.getMethod("helloWorld", new
> Class[0]);
> MySerializedPOJO bundle = new MySerializedPOJO();
> ClassLoader classLoader =
> Thread.currentThread().getContextClassLoader();
> SerializationPolicyProvider serializationPolicyProvider = new
> MyServiceImpl();
> ServerSerializationStreamReader reader = new
> ServerSerializationStreamReader(classLoader,
> serializationPolicyProvider);
> return RPC.encodeResponseForSuccess(targetMethod, bundle,
> reader.getSerializationPolicy());
>
> By assuming that MyServiceImpl extends RemoteService and therefore
> should know the correct policy.
> But this still returns the default serialization policy (I guess?) and
> cause:
> SerializationException: MySerializedPOJO is not assignable to
> 'com.google.gwt.user.client.rpc.IsSerializable' and did not have a
> custom field serializer.
>
> What approach should I use to get the correct serialization policy for
> MyService?
>
> Best regards
> Troels Nørgaard

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

Reply via email to