开发者

taking time to load GWT sample project

开发者 https://www.devze.com 2023-03-14 19:36 出处:网络
I have created one GWT project by using Google plugin. 开发者_开发问答When I run the project, it takes time to display in the browser. Almost it takes 10 seconds to display in the browserI have used g

I have created one GWT project by using Google plugin. 开发者_开发问答When I run the project, it takes time to display in the browser. Almost it takes 10 seconds to display in the browserI have used google plugin's greeting service. It includes One textfield and one button. .What is the reason for taking this much time? What should I need to take care extra to avoid this delay? Following are my configurations

 Eclipse3.6, GWT 2.3 and Tomcat 7.


You see the slowdown since 2.0, because 2.0 introduced the new approach with the development mode. See GWT 2.0 release notes. To avoid it, you not only need to compile the code as suggested here, but also remove the ?gwt.codesvr=127.0.0.1:9997 from URL.

Just to add - you should see the slow down only when you enter an URL. Later, when you modify your code and reload only it is much faster. At least this is how it works for me in FF. Surprisingly Chrome is much worse in it from my experience.

Also - development mode is when you make a default run in Eclipse. It does not need to be in debug.


You can compile the project and that will load the page much faster. That is what the experience will be on a published web-page. Since gwt translates java to javascript when running in development mode (within eclipse), it is slow to load.


The Idea behind GWT is that the compiler compiles javascript code which is executed on client side in the browser.

If you look at your application during development a jetty server is started where the browser plugin communicates with. But during this development phase the code you wrote is executed by the Java Virtual Machine and not the javascript. So this initially takes some time. If you want your browser to response quicker you have to compile the code and deploy it on a servlet container (e. g. tomcat).

The big strength of the development mode of GWT is that your code updates automatically when you change it. Just refresh your browser after a change and see it yourself.

0

精彩评论

暂无评论...
验证码 换一张
取 消