I am following this tutorial and I am stuck with Jetty configuration. This says that
Now, change directory to your Jetty install, and to get a working set of default configuration options, just copy the file contexts/test.xml (which comes packaged with Jetty by default) to a new file:
$ cp contexts/test.xml contexts/web_test.xml
But my jetty install has no /context
directory:
as-MacBook-Air:jetty.home a$ ls
README.TXT
VERSION.txt
bin
demo-base
etc
lib
license-eplv10-aslv20.html
logs
modules
notice.html
resources
start.d
start.ini
start.jar
webapps
What am I missing? Where is jetty text.xml file?
Documentation Link: Configuring a Specific Web Application Deployment
A "context xml" is any XML file that :
org.eclipse.jetty.webapp.WebAppContext
For #2 (Configuring a WebAppContext), an example for Jetty 9 would be
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
"http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/myapp</Set>
<Set name="war"><Property name="jetty.webapps" default="."/>/myapp.war</Set>
<Set name="extractWAR">true</Set>
</Configure>
For #3, the deployer directory, that is determined by your own setup and configuration.
See etc/jetty-deploy.xml
and look for what your monitoredDirName
is.
${jetty.base}/webapps/
${jetty.home}/contexts/
see (etc/jetty-contexts.xml
)${jetty.home}/contexts/
see (etc/jetty-contexts.xml
)Jetty 7 and Jetty 8 had a quirk in the deployers that was poorly understood, you could deploy a webapp as a WAR via the webapp deployer, or as Context via the context deployer, and if you had both deployers, your webapp would be deployed twice. (confusing endless numbers of people).
With Jetty 9, the 2 deployer techniques were merged to make them aware of each other and prevent duplicate webapp deployment.
The logic for deployment in Jetty 9 is as follows:
The webapps directory (aka monitoredDirName
) is scanned by the WebAppProvider.
This provider scans one or more directories (typically "webapps") for contexts to deploy, which may be:
".war"
)To avoid double deployments and allow flexibility of the content of the scanned directories, the provider implements some heuristics to ignore some files found in the scans:
"."
) are ignored".d"
are ignoredfoo/
and foo.war
) then the directory is assumed to be the unpacked WAR and only the WAR is deployed (which may reused the unpacked directory)foo/
and foo.xml
) then the directory is assumed to be an unpacked WAR and only the XML is deployed (which may used the directory in it's configuration)foo.war
and foo.xml
) then the WAR is assumed to be configured by the XML and only the XML is deployed.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With