| Refresh | Home EGTry.com

deploy a web application in jetty outside the default webapps/ directory


How to deploy a standard java web application, say in the directory c:\work\test1, to jetty?

1. create test1.xml under /contexts

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

<Configure class="org.mortbay.jetty.webapp.WebAppContext">
  <Set name="contextPath">/test1</Set>
  <Set name="war">/work/test1</Set>
</Configure>


2. start the jetty web server

java -jar start.jar etc/jetty.xml


3. test. type the following url in the browser

http://localhost:8080/test1