Hiho!

I'm using Atmosphere and I would like to do streaming with GWT-RPC,
currently I'm having a working example, something like this:

My remoteService:
public interface EventService extends RemoteService {
    MyEvent getEvent();
}

So on the server side, I'm doing this:
Method method = this.getClass().getMethod("getEvent", null);
String encoded = RPC.invokeAndEncodeResponse(this, method, null);

Now I can broadcast this encoded string as payload and on the client side,
using this I can get the broadcasted object:
(MyEvent) ssf.createStreamReader(message).readObject();
where message is the payload which was broadcasted and ssf is defined like
this: protected static final SerializationStreamFactory ssf =
GWT.create(EventService.class);

This is great, it works like a charm. Then I've discovered this stuff:
com.google.gwt.user.RemoteServiceObfuscateTypeNames. Which would be great
for production. So I've tested it, and of course it breaks my working stuff,
I've modified like this, but still not working:
Method method = this.getClass().getMethod("getEvent", null);
Stringencoded = RPC.invokeAndEncodeResponse(this, method, null,
getSerializationPolicy(
         "http://127.0.0.1:8888/kfc/";, "DD98F5EAEFEC65CD76A0D7BC1E3C8E8D"));
where getSerializationPolicy() looks like this:

    public SerializationPolicy getSerializationPolicy(String moduleBaseURL,
String strongName) {
        String modulePath = null;
        if (moduleBaseURL != null) {
            try {
                modulePath = new URL(moduleBaseURL).getPath();
            } catch (MalformedURLException ex) {
                System.err.println("Malformed moduleBaseURL: " +
moduleBaseURL);
            }
        }

        SerializationPolicy serializationPolicy = null;

        String contextPath = servletRequest.getContextPath();
        String contextRelativePath =
modulePath.substring(contextPath.length());
        String serializationPolicyFilePath = SerializationPolicyLoader
                .getSerializationPolicyFileName(contextRelativePath +
strongName);

        InputStream is =
context.getResourceAsStream(serializationPolicyFilePath);
        if (is != null) {
            try {
                serializationPolicy =
SerializationPolicyLoader.loadFromStream(is, null);
            } catch (ParseException e) {
                e.printStackTrace(System.err);
            } catch (IOException e) {
                e.printStackTrace(System.err);
            }
        }

        return serializationPolicy;
    }
It's merely copied from RemoteServiceServlet IIRC. I have 2 problems: what
can I do to not hardcode strongName for gwt.rpc file and the moduleBaseURL?
And finally, why isn't it working? It still makes payload as I would do
without inheriting com.google.gwt.user.RemoteServiceObfuscateTypeNames module,
which is bad, because the client can't deserialize it and throwing
SerializationException.

If you could help me to solve my problem, I would be grateful, thanks!

-- 
Regards,
Bálint Kriván

-- 
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