The webapp on webappsite.com is automatically deployed from the ROOT.war file. I didn't need to do anything extra in any configuration files for it to work. However, since I wanted a static file area on that site as well, I went ahead and added a configuration file to set that up. This wasn't necessary to make this site work and was only done to be able to serve static files stored outside of the ROOT.war file.
I also added a configuration file for staticsite.com. This was necessary for this site to work. Both of these configuration files were put into Jetty's contexts directory. The file for webappsite.com is called contexts/webappsite.xml (sorry for the horrid layout -- I need to figure out how to better post xml code in blogger):
<?xml version="1.0" encoding="ISO-8859-1"?>The static site's config file is called contexts/staticsite.xml:
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<configure class="org.mortbay.jetty.handler.ContextHandler">
<call class="org.mortbay.log.Log" name="debug"><arg>Configure webappsite.com site</arg></call>
<set name="contextPath">/web</set>
<set name="resourceBase"><systemproperty name="user.home" default=".">/sites/webappsite.com/web/</systemproperty>
<set name="handler">
<new class="org.mortbay.jetty.handler.ResourceHandler">
<set name="welcomeFiles">
<array type="String">
<item>index.html</item>
</array>
</set>
<set name="cacheControl">max-age=3600,public</set>
</new>
</set>
<set name="VirtualHosts">
<array type="java.lang.String">
<item>192.168.0.1</item>
<item>webappsite.com</item>
<item>www.webappsite.com</item>
<item>alternatedomainforsite.com</item>
<item>www.alternatedomainforsite.com</item>
</array>
</set>
</set>
</configure>
<?xml version="1.0" encoding="ISO-8859-1"?>So the following mappings are now taking place:
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<configure class="org.mortbay.jetty.handler.ContextHandler">
<call class="org.mortbay.log.Log" name="debug"><arg>Configure staticsite.com site</arg></call>
<set name="contextPath">/</set>
<set name="resourceBase"><systemproperty name="user.home" default=".">/sites/staticsite.com/</systemproperty>
<set name="handler">
<new class="org.mortbay.jetty.handler.ResourceHandler">
<set name="welcomeFiles">
<array type="String">
<item>index.htm</item>
</array>
</set>
<set name="cacheControl">max-age=3600,public</set>
</new>
</set>
<set name="VirtualHosts">
<array type="java.lang.String">
<item>staticsite.com</item>
<item>www.staticsite.com</item>
<item>anotherdomainforstaticsite.com</item>
<item>www.anotherdomainforstaticsite.com</item>
</array>
</set>
</set>
</configure>
webappsite.com/ --> jetty/webapps/ROOT.warThis seems to have done the trick!
webappsite.com/web --> sites/webappsite.com/web
staticsite.com/ --> sites/staticsite.com/
No comments:
Post a Comment