0

I am developing GWT based application using JPA as data access layer. My application is required to support three-tier architecture. Main idea is to have HTTP server (Apache) with static content (html/javascript etc.), Web Application server (Glassfish) with business logic (servlets, beans, etc.) and Database server (PostgreSQL).

Is there any easy way to divide content of war file generated for simple GWT application to achieve described architecture?

Maybe there is a maven plugin which will help in creating separate war files with static content and business logic.

I was also considering creating proxy which will intercept GWT-RPC calls and invoke business methods on remote server.

I found very interesting article describing such solution (full article) but it requires a lot of work to achieve my goal. Hopefully there is a library or toolkit which will simplify proxy generation process.

Any ideas will be greatly appreciated.

lhanusiak
  • 63
  • 1
  • 4

1 Answers1

0

I have a similar setup, just Tomcat instead of Glassfish, and maven to build everything. Here's how it works. Apache httpd and Tomcat are connected with mod_jk. Apache forwards all requests to Tomcat except for the GWT module dir (lets call it gwt_module), which contains all the GWT compiled stuff - that gets served by Apache and is configured to be cached. The rest - servlets basically, gets forwarded to Tomcat (RPC, RequestFactory, other servlets). MongoDB as a database server.

Here's the relevant httpd.conf section:

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

Note: I'm not sure that serving static files with apache is faster than serving everything with only tomcat, I use apache for load balancing primarily.

milan
  • 11,872
  • 3
  • 42
  • 49
  • This is quite a cool idea; I never considered fronting GlassFish with Apache HTTPD. I will test mod_jk against my current GlassFish configuration, hopefully everything will go as smooth as you described. Thank you for your quick response and help. – lhanusiak Dec 28 '11 at 06:48
  • I'm not sure that serving static files with apache is faster than serving everything with only tomcat, I use apache for load balancing primarily. – milan Dec 28 '11 at 10:15