GWT 服务器端入口点
我按照这些说明进行操作 http://code.google.com/webtoolkit/usingeclipse.html
似乎有服务器没有入口点功能?如何运行与服务器导出的 rpc 服务无关的后台线程或代码?
例如,如果某个嵌入式数据库需要每 5 分钟更新一次怎么办?那么后台线程将获取这个新数据来进行更新
I followed these instructions
http://code.google.com/webtoolkit/usingeclipse.html
There appears to be no entry point function for the server? How do I run background threads or code not related to the rpc services that the server exports?
For example, what if some embedded database needs to be updated every 5 minutes. So then a background thread would fetch this new data to do the updating
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
GWT是客户端技术,与服务器端无关。您可以使用任何服务器端技术。如果您使用java/servlet,那么您可以选择使用GWT-RPC,这很好,但不是必需的。
Web 应用程序基于请求-答复范例:当有请求时,它们会处理该请求并发回答复。 Servlet 是围绕这个范例设计的。它们在一些最大的网站上使用,而不仅仅是一个玩具(正如您在其他评论中指出的那样)。
当您需要定期运行某些内容时,这通常是作业调度程序<的工作/a>.我推荐 Quartz,它有很棒的文档。还有一个示例如何在servlet环境中初始化它。
GWT is client-side technology and has nothing to do with server-side. You can use any servers-side technology with it. If you use java/servlets then you can optionally use GWT-RPC, which is nice, but not required.
Web applications are based around request-reply paradigm: when there is a request, they handle it and send back the reply. Servlets are designed around this paradigm. They are used at some of the largest sites and are not just a toy (as you noted in other comment).
When you need something to run periodically, then this is usually the job for Job Schedulers. I'd recommend Quartz, which has great documentation. There is also an example how to initialize it in servlet environment.
这不是 Web 应用程序应该如何工作的。请阅读 http://code.google.com/ intl/de-AT/webtoolkit/doc/latest/tutorial/clientserver.html
thats not how web applications are supposed to work. Read http://code.google.com/intl/de-AT/webtoolkit/doc/latest/tutorial/clientserver.html
如果您想在请求到来时运行一些处理并可能包含一些动态部分,您可以将页面制作为 JSP 或 servlet。 GWT 不需要在 HTML 文件中使用。只需要服务器提供的页面是 HTML 即可。所以像服务器端入口点这样的东西要么是JSP,要么是servlet。否则你需要使用 PRC。但如果您需要为加载的每个页面运行 RPC,您可以考虑 在基本响应中嵌入 RPC。
If you want to run some processing when request comes and potentially include some dynamic parts, you can just make your pages to be JSP or servlets. GWT does not need to be used in HTML files. Just the page served by server need to be HTML. So something like server side entry point is either JSP or servlet. Otherwise you need to use PRC. But if you needed to run RPC for every page loaded, you could consider this tip of embedding RPC in the base response.