- What is jetty?
- Jetty directory structure
- Run Jetty
- Deploy applications
What is jetty?
Jetty is an open-source HTTP server, HTTP client, and javax. servlet container. Jetty home page is here http://www.eclipse.org/jetty. Here the http://download.eclipse.org/jetty/ downloads jetty.
Jetty directory structure
Not surprisingly, the downloaded jetty should be a compressed package. You just need to extract it to a directory and it will be OK. The unzipped directory structure and its contents are listed in the table below.
Directory file name |
Description |
License-eplv10-aslv20.html |
Jetty license file |
Readme.txt |
Entry info |
Version.txt |
Release information |
Bin/ |
Run the auxiliary shell script of jetty. |
Demo-base/ |
Demo |
ETC/ |
Jetty xml configuration file directory, mainly including the configuration files required by each module |
LIB/ |
Run all the jar packages required by Jetty |
Logs/ |
Log directory |
Modules/ |
Module definition directory, such as server, HTTP, https, and other module definition files |
Notice.html |
License information |
Resources/ |
Additional resource information, such as log4j Configuration |
Start. d/ |
Contains a series of global INI files, each of which stores various command line parameters |
Start. ini |
The global command line parameter file. The content of this file will be added to the command line parameters, that is, the parameters of Java-jar start. Jar [arg ...]. |
Start. Jar |
Run the jetty JAR File |
Webapps/ |
Webapps folder |
Run Jetty
> cd $JETTY_HOME> java -jar start.jar2013-09-06 13:52:43.326:INFO:oejs.Server:main: jetty-9.1.02013-09-06 13:52:43.358:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/home/gregw/src/jetty-9.1/jetty-distribution/target/distribution/webapps/] at interval 12013-09-06 13:52:43.390:INFO:oejs.ServerConnector:main: Started[email protected]{HTTP/1.1}{0.0.0.0:8080}
OK! Jetty has been successfully run, listening to port 8080, the browser access is OK http: // localhost: 8080
You may have discovered, "Error 404-not found", why?
By default, Jetty scans the $ jetty_home/webapps directory and deploys applications under this directory. However, no applications under webapps are currently available, so the Error 404 is returned.
Deploy applications
Deploying applications in Jetty is very simple. You only need to put the war package or directory containing content under the webapps directory. You can copy the $ jetty_home/demo-base/webapps/root directory to the $ jetty_home/webapps directory, and then access http: // localhost: 8080
Note: the URL of the application deployed under the root (case-sensitive) directory under webapps is the same as the directory (/), which means that the application can be directly accessed through http: // localhost: 8080/instead of http: // localhost: 8080/root access