This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes Hosting multiple web-apps in embedded jetty Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Hosting multiple web-apps in embedded jetty" Watch "Hosting multiple web-apps in embedded jetty" New topic
Author

Hosting multiple web-apps in embedded jetty

aslam parveez
Ranch Hand

Joined: Apr 25, 2006
Posts: 47
Hello,

I have a web-app hosted on embedded jetty. I would like to host the same web-app twice with different context-root so that I can access the app from both context-roots. I have my web-app context configured in jetty.xml like below, how can I have the same app added with a different context-root.
<Set name="handler">
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/abc</Set>
<Set name="war">WebContent</Set>
<Get name="securityHandler">
<Set name="loginService">
<New class="DummyLoginService">
<Call name="start"/>
</New>
</Set>
</Get>
</New>
</Set>
aslam parveez
Ranch Hand

Joined: Apr 25, 2006
Posts: 47
I found a way to have it done. For any one who is interested, please find below the jetty configuration snippet.

<Set name="handler">
<New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
<Set name="handlers">
<Array type="org.eclipse.jetty.server.Handler">
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/abc</Set>
<Set name="war">WebContent</Set>
<Get name="securityHandler">
<Set name="loginService">
<New class="DummyLoginService">
<Call name="start"/>
</New>
</Set>
</Get>
</New>
</Item>
<Item>
<New class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/xyz</Set>
<Set name="war">../otherProj/WebContent</Set>
<Get name="securityHandler">
<Set name="loginService">
<New class="DummyLoginService">
<Call name="start"/>
</New>
</Set>
</Get>
</New>
</Item>
</Array>
</Set>
</New>
</Set>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hosting multiple web-apps in embedded jetty
 
Similar Threads
Can we define same war with two different context-root?
On the ranch - waiting to be lynched
Sample Petclinic does not display static content
Hello world not working on Jetty server
connection pooling