shirobert 发表于 2017-2-1 09:07:46

在gwt1.6 的host模式中 使用tomcat

      从gwt1.6开始,gwt内部集成了Jetty服务器,在host模式中默认使用Jetyy.最近在研究tomcat6的Comet技术,需要用tomcat进行调试。

参考google gwt文档中的
《How do I use my own server in hosted mode instead of GWT's built-in Jetty instance?》
, 成功的将Jetty替换为tomcat6.


具体操作如下[以eclipse为例]:


  1. 将当前gwt程序编译一次; (此时使用的服务器还是Jetty);
  2. 在tomcat的server.xml配置好<Context>(即,将当前程序加入到tomcat启动);
  3. 在gwt的启动配置中加入 -noserver配置, 去掉对默认服务器Jetty的启动:
  

  

 4. 配置端口: 端口需要与当前使用的tomcat端口保持一致:
  

  

 5.
  这里要注意,在页面前面需要将启动程序的path加上... 我的当前程序的path="/messager";
  我的tomcat配置:

<Context docBase="E:\Workspace\EclipseJ2EE\GxtComet\war"   path="/messager" reloadable="true" debug="0">
</Context>
   5. 启动Tomcat.
  6. 启动 gwt web application. (完成...)
页: [1]
查看完整版本: 在gwt1.6 的host模式中 使用tomcat