...
| Section |
|---|
| Column |
|---|
| Code Block |
|---|
| xml |
|---|
| bgColor | FFFFFF |
|---|
| titleBGColor | #54FF9F |
|---|
| title | jettyA.xml |
|---|
|
<Configure id="ServerA" class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
...
<!-- set up the port for ServerA -->
</Set>
<Set name="connectors">
<Array type="org.mortbay.jetty.Connector">
<Item>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">8080</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">10</Set>
</New>
</Item>
</Array>
</Set>
...
<New id="webAppA" <!-- set up a context deployer for Server A -->
<Call name="addLifeCycle">
<Arg>
<New class="org.mortbay.jetty.webappdeployer.WebAppContextContextDeployer">
<Set <Arg><Ref name="contexts"><Ref id="Contexts"/></Arg>Set>
<Arg><SystemProperty <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/webappscontextsA</A</Arg>Set>
<Arg>/webappA</Arg> <Set name="scanInterval">5</Set>
... </New>
... </Arg>
</Call>
</Configure>
|
|
| Column |
|---|
| Code Block |
|---|
| xml |
|---|
| bgColor | FFFFFF |
|---|
| titleBGColor | #AB82FF |
|---|
| title | jettyB.xml |
|---|
|
<Configure id="ServerB" class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
...
<!-- set up the port for ServerB -->
</Set>
<Set name="connectors">
<Array type="org.mortbay.jetty.Connector">
<Item>
<New class="org.mortbay.jetty.security.SslSocketConnector">
<Set name="Port">8443</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="Password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
<Set name="KeyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
</New>
</Item>
</Array>
</Set>
...
<New id="webAppB" <!-- set up a context deployer for ServerB -->
<Arg>
<New class="org.mortbay.jetty.webappdeployer.WebAppContextContextDeployer">
<Arg><Ref <Set name="contexts"><Ref id="Contexts"/></Arg>Set>
<Arg><SystemProperty <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/webapps/B</Arg>contextsB</Set>
<Set name="scanInterval">5</Set>
<Arg>/webappB< </New>
</Arg>
</Call>
</Configure>
|
|
|
Now we need to set up 2 context files, one to describe the webapp we wish to deploy on Server A and the other for the webapp to deploy on Server B. We then put these files into $JETTY_HOME/contextsA or $JETTY_HOME/contextsB respectively.
| Section |
|---|
| Column |
|---|
{code:xml|title=contextA.xml|titleBGColor=#54FF9F|bgColor=FFFFFF <Configure i class="org.mortbay.jetty.webapp.WebAppContext"> <Set name="war"><SystemProperty name="jetty.home"/>/webapps/A</Set> <Set name="contextPath">/webappA</Set> ... </Configure> |
| Column |
|---|
| Code Block |
|---|
| xml |
|---|
| bgColor | FFFFFF |
|---|
| titleBGColor | #AB82FF |
|---|
| title | contextB.xml |
|---|
|
</New><Configure i class="org.mortbay.jetty.webapp.WebAppContext">
<Set name="war"><SystemProperty name="jetty.home"/>/webapps/B</Set>
<Set name="contextPath">/webappB</Set>
...
</Configure>
|
|
|
You run both Server instances in the same JVM by providing them both on the runline:
...
| Code Block |
|---|
|
<Configure class="org.mortbay.jetty.Server">
<Set name="ThreadPool">
... <!-- set up both connectors -->
<Set name="connectors">
<Array type="org.mortbay.jetty.Connector">
<Item>
<New class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">8080</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">1</Set>
<Set name="name">connA</Set>
</New>
</Item>
<Item>
<New id="connB" class="org.mortbay.jetty.nio.SelectChannelConnector">
<Set name="port">9090</Set>
<Set name="maxIdleTime">30000</Set>
<Set name="Acceptors">1</Set>
<Set name="name">connB</Set>
</New>
</Item>
</Array>
</Set>
</Configure>
|
| Code Block |
|---|
|
<New id="webAppA" <Configure class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref<Set idname="Contexts"/></Arg>
<Arg><SystemProperty war"><SystemProperty name="jetty.home"/>/webapps/A</Arg>Set>
<Arg><Set name="contextPath">/webappA</Arg>Set>
<Set name="connectorNames">
<Array type="String">
<Item>0.0.0.0:8080<<Item>connA</Item>
</Array>
</Set>
...
</New>
...Configure>
|
| Code Block |
|---|
|
<Configure <New id="webAppB" class="org.mortbay.jetty.webapp.WebAppContext">
<Arg><Ref<Set idname="Contexts"/></Arg>
<Arg><SystemProperty war"><SystemProperty name="jetty.home"/>/webapps/B</Arg>Set>
<Arg><Set name="contextPath"/webappB</Arg>Set>
<Set name="connectorNames">
<Array type="String">
<Item>0.0.0.0:9090<<Item>connB</Item>
</Array>
</Set>
...
</New>
...
</Configure>
|