What do you use for client to server communication with GWT?

三世轮回 提交于 2019-12-05 23:38:11

问题


GWT RPC is proprietary but looks solid, supported with patterns by Google, and is mentioned by every book and tutorial I've seen. Is it really the choice for GWT client/server communcation? Do you use it and if not why and what you chose? I assume that I have generic server application code that can accommodate for RPC, EJBs, web services/SOAP, REST, etc.

Bonus question: any security issues with GWT RPC I need to be aware of?


回答1:


We primarily use three methods of communications:

  1. GWT-RPC - This is our primary and prefered mechanism, and what we use whenever possible. It is the "GWT way" of doing things, and works very well.
  2. XMLHttpRequest using RequestBuilder - This is typically for interaction with non-GWT back ends, and we use this mainly to pull in static web content that we need during runtime (something like server side includes). It is useful especially when we need to integrate with a CMS. We wrap our RequestBuilder code in a custom "Panel" (that takes a content URI as its constructor parameter, and populates itself with the contents of the URI).
  3. Form submission using FormPanel - This also requires interaction with a non-GWT back end (custom servlet), and is what we currently use to do cross site communications. We don't really communicate "cross site" per se, but we do sometimes need to send data over SSL on a non-SSL page, and this is the only way we've been able to do it so far (with some hacks).



回答2:


The problem is that you are on a web browser so any non-http protocol is pretty much not guaranteed to work (might not get through a proxy).

What you can do is isolate the GWT-RPC stuff in a single replaceable class and strip it off as soon as possible.

Personally I'd just rely on transferring a collection of objects with the information I needed encoded inside the collection--that way there is very little RPC code because all your RPC code ever does is "Collection commands=getCollection()", but there would be a million other possibilities.

Or just use GWT-RPC as it was intended, I don't think it's going anywhere.



来源:https://stackoverflow.com/questions/1156563/what-do-you-use-for-client-to-server-communication-with-gwt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!