简体   繁体   English

GWT中最佳应用程序架构

[英]Best architecture for applications in GWT

I'm starting to study GWT now, and have a very general question, I could maybe teach myself with a little more experience, but I don't want to start it wrong, so I decided to ask you. 我现在开始学习GWT,并且有一个非常笼统的问题,也许我可以教自己一点点经验,但是我不想把它弄错,所以我决定问你。

I always develop using JSF, having separate packages for beans, controllers and managedbeans. 我总是使用JSF进行开发,它具有针对bean,控制器和托管bean的独立软件包。

However, as the GWT uses RPC, I will not have managedbeans, right? 但是,由于GWT使用RPC,所以我将没有ManagedBeans,对吗? So, GWT automatically handles user session for me, or do I have to do it myself? 因此,GWT会自动为我处理用户会话,还是我必须自己做?

What is the best package structure for the project? 该项目的最佳包装结构是什么?

It is best to use RPC, or create a webservice and access the webservice in GWT? 最好使用RPC或创建Web服务并在GWT中访问Web服务?

It's hard to host the application on a tomcat server? 在tomcat服务器上托管应用程序很难吗?

Is there a test saying which server is faster for GWT? 是否有测试说哪个服务器对GWT更快?

Thank you. 谢谢。

However, as the GWT uses RPC, I will not have managedbeans, right? 

True, GWT RPC uses POJOs. 的确,GWT RPC使用POJO。

So, GWT automatically handles user session for me, or do I have to do it myself?

GWT is pure AJAX APP - client code (normally) runs in one browser window (similar to gmail) and does not reload the web page. GWT是纯AJAX APP-客户端代码(通常)在一个浏览器窗口(类似于gmail)中运行,并且不会重新加载网页。 This means that the application state is always there - no need for sessions (as a means of saving state). 这意味着应用程序状态始终存在-无需会话(作为保存状态的一种方式)。 You still might need sessions for user authentication, but this is usually handled by servlet container. 您仍然可能需要会话进行用户身份验证,但这通常由servlet容器处理。

What is the best package structure for the project?

Three packages: client , server and shared . 三种软件包: clientservershared Client for GWT client code, server for server (also RPC) code and shared for POJOs that are used by both client and server. Client对于GWT客户端代码, server对服务器(也RPC)代码和shared用于由客户端和服务器使用的POJO。

It is best to use RPC, or create a webservice and access the webservice in GWT?

Go with GWT-RPC or (better, newer) with RequestFactory. 使用GWT-RPC或(更好,更新)使用RequestFactory。

It's hard to host the application on a tomcat server?

It's straightforward: GWT client code is compiled to JS/html and is hosted as any static content. 简单明了:GWT客户端代码被编译为JS / html,并托管为任何静态内容。 RPC server code is just Servlets - normal web.xml registration. RPC服务器代码只是Servlet-正常的web.xml注册。

Is there a test saying which server is faster for GWT?

No clue, but IMHO does not matter, because most of the latency will come from database and network. 毫无头绪,但是恕我直言并不重要,因为大多数延迟都来自数据库和网络。

Also have a look at http://code.google.com/p/gwt-platform/ 也可以看看http://code.google.com/p/gwt-platform/

This framework is really great and follow all suggested best practices(eg MVP) by google and give you as well great support for gin, gwt dispatcher, website crawling, history with tokens, code splitting via gwt async etc. 这个框架真的很棒,并遵循google建议的所有最佳实践(例如MVP),并为您提供对gin,gwt调度程序,网站爬网,令牌历史记录,通过gwt异步进行代码拆分等的强大支持。

If you want to set up a good project structure try to use the maven gwt plugin( http://mojo.codehaus.org/gwt-maven-plugin/ ) it helps you a lot with setting up an initial structure and manage your build process. 如果您想建立一个好的项目结构,请尝试使用maven gwt插件( http://mojo.codehaus.org/gwt-maven-plugin/ ),它可以帮助您建立一个初始结构并管理您的构建处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM