• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hosting multiple web-apps in embedded jetty

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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>
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic