2/? Pbs with GWT + Eclipse + Jetty + Neo4J

35 views
Skip to first unread message

Guillen Antonio

unread,
Oct 13, 2021, 4:00:03 AM10/13/21
to google-we...@googlegroups.com
HI all,

I am not comfortable with client-server and RPC and HTTPServlet operation at all.
I get the following message after my request:

200 - POST /spotgwt/spotData (127.0.0.1) 496 bytes
   Request headers
      Host: 127.0.0.1:8887
      User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0
      Accept: */*
      Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
      Accept-Encoding: gzip, deflate
      Content-Type: text/x-gwt-rpc; charset=utf-8
      X-GWT-Permutation: A082E84D087467DED16699006D694A7B
      X-GWT-Module-Base: http://127.0.0.1:8887/spotgwt/
      Content-Length: 228
      Origin: http://127.0.0.1:8887
      DNT: 1
      Connection: keep-alive
      Referer: http://127.0.0.1:8887/SpotGWT.html
      Sec-Fetch-Dest: empty
      Sec-Fetch-Mode: cors
      Sec-Fetch-Site: same-origin
   Response headers
      Date: Wed, 13 Oct 2021 07:40:08 GMT
      Content-Encoding: gzip
      Content-Length: 496
      Content-Type: application/json; charset=utf-8
      Content-Disposition: attachment

Can you tell me what this means. Because at first glance I understand that my request is successful, and  the content of the response is in a zip and that the length of the zip is 496 bytes in json format. Attachment ?????

The problem is that my RPC call tells me that it has failed in the following piece of code:


image.png
I look forward to your reply.
Thanks a lot for your help
Antonio

David Nouls

unread,
Oct 13, 2021, 6:03:52 AM10/13/21
to google-we...@googlegroups.com

I see multiple problems with your code. The most important being that you are ignoring the fact that an rpc call is asynchronous. So the load method will ralways return null because the request has not been executed when the method returns.

Another problem is the fact that the async is returning List<Object>, which would mean gwt needs to generate serializers for all object types in you application at compile time.

Another one is that you seem to want to use java introspection to dynamically load classes in GWT, which is not supported (Class.forName).
<image.png>
I look forward to your reply.
Thanks a lot for your help
Antonio

--
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-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq_jF_Z96s43u_Gm7Z6omqU6H7fQ8758DmTX8yavu1mBMg%40mail.gmail.com.

Guillen Antonio

unread,
Oct 13, 2021, 8:21:12 AM10/13/21
to google-we...@googlegroups.com
Hi David,

Thanks a lot for your remarks, but I need some explanation, as tell in my message i am bot confortable with http/server/remote, ....

1. You say: The most important being that you are ignoring the fact that an rpc call is asynchronous. So the load method will ralways return null because the request has not been executed when the method returns.
   But it's always that is describe in all the examples of GWT. And the request is yet execute on the return method, as is shown here after:
image.png
2.You say: Another problem is the fact that the async is returning List<Object>....
But I have the same problem if I return a List<CartographyImpl> and if i set no more Class.forName but CartographyImpl
3. see above.

So can you give me more informations...

Thanks a lot for your help

Antonio


Guillen Antonio

unread,
Oct 13, 2021, 8:31:29 AM10/13/21
to google-we...@googlegroups.com
Hi David,

For your last remark:
Another one is that you seem to want to use java introspection to dynamically load classes in GWT, which is not supported (Class.forName).
I think it's not a pb because this part is executed on the server side and all Java in this case is available.

Thanks for your help
Antonio



Le mer. 13 oct. 2021 à 12:03, David Nouls <david...@gmail.com> a écrit :

David Nouls

unread,
Oct 13, 2021, 9:05:53 AM10/13/21
to google-we...@googlegroups.com
Hi Antonio,

The “load”method that you showed in the code snippet starts the invocation of an RPC method on the spotDataService. 
But the AsyncResponse object that you provide in the loadDataServer will only get invoked after the method already returned.

Any async operation that you do is not executed right away. A request is sent by the browser to your server (as you see in the server logs), but the loadDataServer method in the browser returns immediately, it does not wait for the response. So the provided callback is not yet called when the method returns. As a result, the load method will return the current value of objectRet (probably null or an old value).

Afterwards when the response is received from the server, the callback method gets invoked to handle the success or failure in the browser (so that is why I said that this Class.forName will not work … the callback code runs in the browser, not the server). 

So in the end you will probably see the Window.alert statements getting executed, but not when you expect it.

From the code + logs that you have given us I don’t know if you get a success or failure since you did not provide the information you are showing in the window.alert invocations (which, if I recollect that correctly, will popup some modal dialogs in the browser).
On 13 Oct 2021, 14:20 +0200, Guillen Antonio <tonio....@gmail.com>, wrote:
Hi David,

Thanks a lot for your remarks, but I need some explanation, as tell in my message i am bot confortable with http/server/remote, ....

1. You say: The most important being that you are ignoring the fact that an rpc call is asynchronous. So the load method will ralways return null because the request has not been executed when the method returns.
   But it's always that is describe in all the examples of GWT. And the request is yet execute on the return method, as is shown here after:

Guillen Antonio

unread,
Oct 13, 2021, 1:59:47 PM10/13/21
to google-we...@googlegroups.com
HI David,
Thanks a lot for your answer. Your explanations are clear and I think they will help me a lot. I will work again on my classes ans methods, taking in account your remarks. I understand much better what happen and I understand why few weeks ago it was working and now no more: Because I have tried to generalize a lot of stuffs and for this I modify the way to do all the RPC, before it was much simplier.   I will work on it tomorrow.
Thanks again for your help.

Antonio

Reply all
Reply to author
Forward
0 new messages