如何将 GWT 或 Vaadin 与 Play Framework 2.0 集成 [英] How to integrate GWT or Vaadin with Play Framework 2.0
问题描述
是否可以使用 GWT 或 Vaadin 实现 Play Framework 2.x 网络应用程序的客户端?
Play 1.x 有一个提供 GWT 集成的特殊模块,但我找不到在 Play 2.x 版本中一起使用这些技术的示例.这些技术可以集成吗?是否有模块,或者必须使用其他方法?
Play 1.x has a special module that provides GWT integration, but I can not find examples of the use of these technologies together in Play 2.x version. Can these technologies be integrated? Is there a module, or must some other approach be used?
推荐答案
GWT 和 Play2 可以无缝协作,就像 GWT 可以与 python 和 go 后端一起使用一样.
GWT and Play2 can work together seamlessly, just as GWT can be used with python and go backends.
在 Play2 中使用 GWT 有两部分,提供静态文件和客户端-服务器通信.
Using GWT with Play2 has two parts, serving static files and client-server communication.
对于 GWT 生成的静态文件(js、css、img ..),您只需将它们添加到 Play2
public
目录,它们将根据路由配置进行访问.
For the GWT produced static files (js, css, img..) you can just add them to the Play2
public
directory, and they will be accessible based on the routes configuration.
对于客户端-服务器通信,您最好的选择是使用纯 json-rest 方法,因为请求工厂、gwt-rpc 对 J2EE servlet 有一些依赖性.
For client-server communication your best bet is using a pure json-rest approach, as request-factory, gwt-rpc have some dependency on J2EE servlets.
有很多使用 Play2 提供 json/REST api 的示例,以及大量使用 GWT 与 json/REST API 交互的示例.
There are plenty examples of providing a json/REST api with Play2, and plenty examples of interacting with json/REST APIs with GWT.
这篇关于如何将 GWT 或 Vaadin 与 Play Framework 2.0 集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!