users@glassfish.java.net

Re: Multiple web-apps, Domains

From: Wolfram Rittmeyer <w.rittmeyer_at_jsptutorial.org>
Date: Thu, 04 Jun 2009 19:50:25 +0200

Just to get your question right:
You have two apps, say webapp1 and webapp2. And you have two domains,
say domain1.com and domain2.com.

Thus any request to http://www.domain1.com should be served by webapp1
and to http://www.domain2.com should be served by webapp2 without the
need to specify any additional contextpath?

If this is what you want to achieve, you essentially have to do two things:

First create virtual servers for both of your domains. Either using the
admin console or asadmin:

asadmin create-virtual-server --hosts www.domain1.com,domain1.com
--httplisteners http-listener-1,http-listener-2 domain1

Then you have to deploy your apps and tell them to use these virtual
servers. Again you can do this using the admin console or asadmin:

asadmin deploy --name nosilverbullet --virtualservers domain1
--contextroot / yourWebapp1.war

For this to work, your virtual server should _not_ use any default web
modules.


More about this can be found at Jan's and my blogs:
http://blogs.sun.com/jluehe/entry/virtual_hosting_features_in_glassfish
http://weblogs.java.net/blog/writtmeyer/archive/2008/02/virtual_servers.html


--
Wolfram Rittmeyer