...
Suppose we have a webapp, xxx.war that we want to be served from all of the above names and addresses. Then we would configure the webapp like so:
| Code Block | ||
|---|---|---|
| ||
<New<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref id="Contexts"/></Arg>
<Arg><SystemProperty <Set name="jetty.homecontextPath"/>/webapps/xxx.war</Arg>
<Arg>/xxx</Arg>Set>
<Set name="defaultsDescriptorwar"><SystemProperty name="jetty.home" default="."/>/etcwebapps/webdefaultxxx.xml<war</Set>
<Set name="VirtualHostsvirtualHosts">
<Array type="java.lang.String">
<Item>333.444.555.666</Item>
<Item>127.0.0.1</Item>
<Item>www.blah.com</Item>
<Item>www.blah.net</Item>
<Item>www.blah.org</Item>
</Array>
</Set>
</New>Configure>
|
Assuming we'd configured a connector listening on port 8080, then webapp xxx.war would be available at all of the following addresses:
...
Suppose also we have another webapp, zzz.war. We want xxx.war to be deployed as above, and zzz.war to be deployed only from 777.888.888.111, www.other.com, www.other.net and www.other.org:
| Code Block | ||
|---|---|---|
| ||
<!-- webapp xxx.war -->
<New<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref id="Contexts"/></Arg>
<Arg><SystemProperty <Set name="jetty.homecontextPath"/>/webapps/xxx.war</Arg>
<Arg>/xxx</Arg>Set>
<Set name="defaultsDescriptorwar"><SystemProperty name="jetty.home" default="."/>/etcwebapps/webdefaultxxx.xml<war</Set>
<Set name="VirtualHostsvirtualHosts">
<Array type="java.lang.String">
<Item>333.444.555.666</Item>
<Item>127.0.0.1</Item>
<Item>www.blah.com</Item>
<Item>www.blah.net</Item>
<Item>www.blah.org</Item>
</Array>
</Set>
</New>Configure>
|
| Code Block | ||
|---|---|---|
| ||
<!-- webapp zzz.war -->
<New<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref id="Contexts"/></Arg>
<Arg><SystemProperty <Set name="jetty.homecontextPath"/>/webapps/zzz.war</Arg>
<Arg>/zzz</Arg>Set>
<Set name="defaultsDescriptorwar"><SystemProperty name="jetty.home" default="."/>/etcwebapps/webdefaultzzz.xml<war</Set>
<Set name="VirtualHostsvirtualHosts">
<Array type="java.lang.String">
<Item>777.888.888.111</Item>
<Item>www.other.com</Item>
<Item>www.other.net</Item>
<Item>www.other.org</Item>
</Array>
</Set>
</New>Configure>
|
Webapp xxx.war is still available at:
...
Very simply, we just supply the same context path for each webapp, leaving the disjoint set of virtual host definitions as before:
| Code Block | ||
|---|---|---|
| ||
<New<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref<Set idname="Contexts"/></Arg>
<Arg><SystemProperty war"><SystemProperty name="jetty.home"/>/webapps/xxx.war</Arg>Set>
<Arg>/</Arg>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</contextPath">/</Set>
<Set name="VirtualHostsvirtualHosts">
<Array type="java.lang.String">
<Item>333.444.555.666</Item>
<Item>127.0.0.1</Item>
<Item>www.blah.com</Item>
<Item>www.blah.net</Item>
<Item>www.blah.org</Item>
</Array>
</Set>
</New>Configure>
|
| Code Block | ||
|---|---|---|
| ||
<New<Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref<Set idname="Contexts"/></Arg>
<Arg><SystemProperty war"><SystemProperty name="jetty.home"/>/webapps/zzz.war</Arg>Set>
<Arg>/</Arg>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</contextPath">/</Set>
<Set name="VirtualHostsvirtualHosts">
<Array type="java.lang.String">
<Item>777.888.888.111</Item>
<Item>www.other.com</Item>
<Item>www.other.net</Item>
<Item>www.other.org</Item>
</Array>
</Set>
</New>Configure>
|
Now, webapp xxx.war is available at:
...