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 Le mer. 13 oct. 2021 à 15:05, David Nouls <[email protected]> a écrit : > 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 <[email protected]>, > 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:* > <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 > > > > Le mer. 13 oct. 2021 à 12:03, David Nouls <[email protected]> a > écrit : > >> >> 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). >> On 13 Oct 2021, 09:58 +0200, Guillen Antonio <[email protected]>, >> wrote: >> >> 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 <http://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/ <http://127.0.0.1:8887/spotgwt/> >> Content-Length: 228 Origin: http://127.0.0.1:8887 >> <http://127.0.0.1:8887> DNT: 1 Connection: keep-alive >> Referer: http://127.0.0.1:8887/SpotGWT.html >> <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 >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq_jF_Z96s43u_Gm7Z6omqU6H7fQ8758DmTX8yavu1mBMg%40mail.gmail.com >> <https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq_jF_Z96s43u_Gm7Z6omqU6H7fQ8758DmTX8yavu1mBMg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/google-web-toolkit/48970e18-bc80-4df0-b8d7-84adde1c63cb%40Spark >> <https://groups.google.com/d/msgid/google-web-toolkit/48970e18-bc80-4df0-b8d7-84adde1c63cb%40Spark?utm_medium=email&utm_source=footer> >> . >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq9dSLVNG2KhhfFE29px9_F8-tOP2hQ5KYmpFsnfqkEV8A%40mail.gmail.com > <https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq9dSLVNG2KhhfFE29px9_F8-tOP2hQ5KYmpFsnfqkEV8A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-web-toolkit/6b482d6d-f3f1-43d2-8af7-e5f9b3d6ae54%40Spark > <https://groups.google.com/d/msgid/google-web-toolkit/6b482d6d-f3f1-43d2-8af7-e5f9b3d6ae54%40Spark?utm_medium=email&utm_source=footer> > . > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CAKULUq_k2gwo66%3DgWG8p53-EKuxN3V1njd51UAFDiRfPeMBo4Q%40mail.gmail.com.
