Thursday, February 18, 2016

Re: Use synchronous RPC on browser close ?

Hi Rocco,

thank you very much for your support. I am a colleague of Dominic and we managed to get our synchronous call.
In addition we added a service for our close tab event, so the manipulated call, proxy etc. is only used on the specified event.
That was necessary, because with the entry you provided for the *.gwt.xml, the manipulated call was applied in general.

Thanks and regards, Connor

Am Mittwoch, 17. Februar 2016 15:10:10 UTC+1 schrieb Rocco De Angelis:
Hi Dominic,

I'm sorry I forgot two classes and a little change that you have also to do!

In your *.gwt.xml you need to add following:

<generate-with class="com.aris.modeling.client.webapp.utils.rebind.rpc.GetRpcServiceGenerator">
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
</generate-with>

Attached also the two missing files.

Of course you have to change maybe the package names for the GetRpcServiceGenerator!

After this you can simply cast your RemoteService:

public static class Instance {
private static GWTDesignerRPCServiceAsync ourSyncInstance;
private static GWTDesignerRPCServiceAsync ourInstance;

static {
ourInstance = GWT.create(GWTDesignerRPCService.class);
ourSyncInstance = GWT.create(GWTDesignerRPCService.class);
((GetRemoteServiceProxy)ourSyncInstance).setSync(true);
}


public static synchronized GWTDesignerRPCServiceAsync get() {
return ourInstance;
}

public static synchronized GWTDesignerRPCServiceAsync getSync() {
return ourSyncInstance;
}
}

Am Mittwoch, 17. Februar 2016 14:48:50 UTC+1 schrieb Dominic Warzok:
Hey, thanks for the hint with baconApi but it's the same that the most of our users use IE. 

@Rocco: 

Can you post a little example how you use the synchronous callback. We tried to use the provided example. 

We try to cast our ascync service to GetRemoteServiceProxy but an error occured.

Error: 

SEVERE: Exception caught: com.SchumannGmbH.cam.web.client.CamService_Proxy cannot be cast to com.SchumannGmbH.cam.web.shared.rpc.GetRemoteServiceProxy
com
.google.gwt.event.shared.UmbrellaException: Exception caught: com.SchumannGmbH.cam.web.client.CamService_Proxy cannot be cast to com.SchumannGmbH.cam.web.shared.rpc.GetRemoteServiceProxy
 at com
.google.gwt.event.shared.HandlerManager.fireEvent(HandlerManager.java:129)
 at com
.google.gwt.event.logical.shared.CloseEvent.fire(CloseEvent.java:56)
 at com
.google.gwt.event.logical.shared.CloseEvent.fire(CloseEvent.java:41)
 at com
.google.gwt.user.client.Window.onClosed(Window.java:839)
 at sun
.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java
.lang.reflect.Method.invoke(Method.java:606)
 at com
.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
 at com
.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
 at com
.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
 at com
.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
 at com
.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
 at com
.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
 at com
.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
 at com
.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
 at com
.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
 at com
.google.gwt.core.client.impl.Impl.apply(Impl.java)
 at com
.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
 at sun
.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
 at sun
.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java
.lang.reflect.Method.invoke(Method.java:606)
 at com
.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
 at com
.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
 at com
.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
 at com
.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
 at com
.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
 at com
.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
 at java
.lang.Thread.run
...

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment