GWT三层架构

时间:2011-12-27 06:14:50

标签: gwt jpa-2.0 three-tier

我正在使用JPA作为数据访问层开发基于GWT的应用程序。我的应用程序需要支持三层体系结构。主要思想是将 HTTP服务器(Apache)与静态内容(html / javascript等), Web应用程序服务器(Glassfish)与业务逻辑(servlets,bean等) 。)和数据库服务器(PostgreSQL)

有没有简单的方法来划分为简单的GWT应用程序生成的war文件内容来实现所描述的架构?

也许有一个maven插件可以帮助用静态内容和业务逻辑创建单独的war文件。

我还在考虑创建代理,它将拦截GWT-RPC调用并在远程服务器上调用业务方法。

我发现非常有趣的文章描述了这样的解决方案(full article),但要实现我的目标需要做很多工作。希望有一个库或工具包可以简化代理生成过程。

我们将非常感谢任何想法。

1 个答案:

答案 0 :(得分:0)

我有类似的设置,只有Tomcat而不是Glassfish,并且maven可以构建所有内容。这是它的工作原理。 Apache httpd和Tomcat与mod_jk连接。 Apache将所有请求转发给Tomcat,除了GWT模块dir(让我们称之为gwt_module),其中包含所有GWT编译的东西 - 由Apache提供并配置为缓存。 其余的 - servlet基本上被转发到Tomcat(RPC,RequestFactory,其他servlet)。 MongoDB作为数据库服务器。

这是相关的httpd.conf部分:

JkMount  /* webbalancer
JkUnMount /gwt_module/*  webbalancer
Alias /gwt_module "/srv/web/app_servers/tomcat-1/webapps/ROOT/gwt_module/"

<Directory  "/srv/web/app_servers/tomcat-1/webapps/ROOT/gwt_module/">
    Order deny,allow
    allow from all
    Options -Indexes
    <FilesMatch "\.cache\.*">
        Header set Cache-control max-age=31536000
#       Header unset ETag
#       FileETag None
    </FilesMatch>

# turning off ETags, to force browsers to rely only on Cache-Control and Expires headers.
# for some reason, FF wasn't using the cache for JS files if ETags are on.
  Header unset ETag
  FileETag None
</Directory>

# Tell clients to keep images in the cache
ExpiresActive On
ExpiresByType image/x-icon A2592000
ExpiresByType image/gif A2592000
ExpiresByType image/png A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/jpeg A2592000
#ExpiresByType application/x-javascript A2592000
ExpiresByType text/css A2592000
ExpiresByType application/xhtml+xml A2592000

# Compress output for text
AddOutputFilterByType DEFLATE text/html text/xml text/css application/x-javascript text/javascript application/javascript

注意:我不确定使用apache提供静态文件比仅使用tomcat提供服务更快,我主要使用apache进行负载平衡。

相关问题