-
- 1. Introducing the Jetty Server
-
- Jetty is an open source project that provides features such as HTTP servers, HTTP clients, and servlet containers.
-
- 2. What version of Jetty server should I use?
-
- So far, Jetty9 is the latest version, and has a lot of powerful features than the previous version jetty, but there are still many people using the older version of the jetty server, we solemnly recommend you use Jetty9, because he is the jetty version of the representative, And the official is currently active in Jetty9, and will be maintained for Jetty9 for many years.
-
- Jetty version of the schedule:
-
Version |
| Year
Home |
JVM |
Protocols |
Servlet |
JSP |
Status |
9.3 |
2014 |
Eclipse |
1.7 |
http/1.1, Http/2 Rfc2616,javax.websocket, SPDY v3 |
3.1 |
2.3 |
Experimental |
9.2 |
2014 |
Eclipse |
1.7 |
http/1.1 Rfc2616,javax.websocket, SPDY v3 |
3.1 |
2.3 |
Stable |
8 |
2009- |
Eclipse/codehaus |
1.6 |
http/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 |
3.0 |
2.2 |
Mature |
7 |
2008- |
Eclipse/codehaus |
1.5 |
http/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 |
2.5 |
2.1 |
Mature |
6 |
2006-2010 |
Codehaus |
1.4-1.5 |
http/1.1 RFC2616 |
2.5 |
2.0 |
Venerable |
5 |
2003-2009 |
Sourceforge |
1.2-1.5 |
http/1.1 RFC2616 |
2.4 |
2.0 |
Deprecated |
4 |
2001-2006 |
Sourceforge |
1.2, J2ME |
http/1.1 RFC2616 |
2.3 |
1.2 |
Ancient |
3 |
1999-2002 |
Sourceforge |
1.2 |
http/1.1 RFC2068 |
2.2 |
1.1 |
Fossilized |
2 |
1998-2000 |
Mortbay |
1.1 |
http/1.0 RFC1945 |
2.1 |
1.0 |
Legendary |
1 |
1995-1998 |
Mortbay |
1.0 |
http/1.0 RFC1945 |
- |
- |
Mythi |
- Jetty, a lightweight server for Java EE specifications, implemented the important servlet, and the introduction of Web Profile,javaee on the recent Java EE platform was realized that for most developers, only Java EE some of the many techniques.
- However jetty does not load all Web profile technology, Jetty's architecture is designed to be a container for third-party implementations that you add to the functionality you really need.
- In the fourth edition of the Java EE-7 specification, some of the existing features have been updated and some new features have been added:
JSR |
Name |
Included with jetty-9.1.x |
Pluggable |
JSR 340 |
Servlet Specification API 3.1 |
Yes |
|
JSR 344 |
Java Server Faces 2.2 (JSF) |
No |
Yes, Mojarra or myfaces |
JSR 245/JSR 341 |
Java Server Pages 2.3/java Expression Language 3.0 (jsp/el) |
Yes |
Yes |
JSR 52 |
Java Standard Tag Library 1.2 (JSTL) |
Yes |
Yes |
JSR 45 |
Debugging support for other Languages 1.0 |
Yes (via JSP) |
Yes (via JSP) |
JSR 346 |
Contexts and Dependency injection for the Java EE Platform 1.1 (Web Beans) |
No |
Yes, Weld |
JSR 330 |
Dependency Injection for Java 1.0 |
No |
Yes as part of a CDI implementation, Weld |
JSR 316 |
Managed Beans 1.0 |
No |
Yes, as part of another technology |
JSR 345 |
Enterprise JavaBeans 3.2 Lite |
No |
|
JSR 338 |
Java persistance 2.1 (JPA) |
No |
Yes, eg Hibernate |
JSR 250 |
Common Annotations for the Java Platform 1.2 |
Yes |
Partially (for Non-core Servlet Spec annotations) |
JSR 907 |
Java Transaction API 1.2 (JTA) |
Yes |
Yes |
JSR 349 |
Bean Validation 1.1 |
No |
Yes as part of another technology eg JSF, or a stand-alone implementation such as Hiberate Validator |
JSR 339 |
Java API for RESTful Web Services 2.0 (JAX-RS) |
No |
|
JSR 356 |
Java API for Websocket 1.0 |
Yes |
No |
JSR 353 |
Java API for JSON Processing 1.0 (JSON-P) |
No |
Yes, eg json-p reference implementation |
JSR 318 |
Interceptors 1.2 |
No |
Yes as part of a CDI implementation |
- I also provide Java EE 6 Web profile as a reference, after all, Java EE 6 is currently the most widely used.
JSR |
Name |
Included with jetty-9.0.x |
Pluggable |
JSR 315 |
Servlet Specification API 3.0 |
Yes |
|
JSR 314 |
JavaServer Faces 2.0 (JSF) |
No |
Yes, for example, Mojarra or myfaces |
JSR 245 |
JavaServer Pages 2.2/java Expression Language 2.2 (Jsp/el) |
Yes |
Yes |
JSR 52 |
Java Standard Tag Library 1.2 (JSTL) |
Yes |
Yes |
JSR 45 |
Debugging support for other Languages 1.0 |
Yes (via JSP) |
Yes (via JSP) |
JSR 299 |
Contexts and Dependency injection for the Java EE Platform 1.0 (Web Beans) |
No |
Yes, Weld or Openwebbeans |
JSR 330 |
Dependency Injection for Java 1.0 |
No |
Yes as part of a CDI implementation, Weld |
JSR 316 |
Managed Beans 1.0 |
No |
Yes, as part of another technology. |
JSR 318 |
Enterprise JavaBeans 3.1 |
No |
Yes, OPENEJB |
JSR 317 |
Java persistance 2.0 (JPA) |
No |
Yes, Hibernate |
JSR 250 |
Common Annotations for the Java Platform |
Yes |
Partially (for Non-core Servlet Spec annotations) |
JSR 907 |
Java Transaction API (JTA) |
Yes |
Implementations is pluggable, such as Atomikos, Jotm, Jencks (Geronimo Transaction Manager) |
JSR 303 |
Bean Validation 1.0 |
No |
Yes as part of another technology (JSF), or a stand-alone implementation such as Hiberate Validator |
- There are many different ways in which you can use the jetty server, embed jetty in your application, or start him on a different build system, based on the different languages of the JVM virtual machine, or deploy the Web application as a separate bundle.
- Download Jetty:
- The standalone jetty bundle now has a valid connection to the Eclipse Foundation download:
- Http://download.eclipse.org/jetty
- The files in zip and gzip format are available, and files for your system are downloaded. Note files that end with the extension. sha or. MD5 are checksum files. Unzip in your convenient directory, after extracting the root directory as
JETTY_HOME
or as
$(jetty.home)
- The contents directory of the Bundle package:
| Location
Description |
License-eplv10-aslv20.html |
Jetty's license file |
README.txt |
Useful Start Information |
VERSION.txt |
Version information |
bin/ |
Store a shell script that helps to run a utility on a jetty UNIX system |
demo-base/ |
Jetty Basic directory, used to run the Jetty Server sample application |
etc/ |
Jetty related XML configuration file directory files |
lib/ |
Running jetty-related jar packages |
logs/ |
Directory of request logs |
modules/ |
Catalog of modules |
Notice.html |
License information |
resources/ |
This directory needs to be loaded into additional resources under CLASSPATH (active configuration is active) |
start.d/ |
The directory where INI files are stored, with valid command-line arguments (such as Start.ini) |
Start.ini |
The file contains the parameter information |
Start.jar |
Executable jar to start jetty |
webapps/ |
Storage directory for Web applications |
-
Start Jetty
- Jetty default is to start on port 8080 and run the command:
CD your jetty unpacked directory Java-jar Start.jar
Then enter http://localhost:8080 in the browser to access it.
After Jetty 9.1, the jetty bundle is a Web application without any examples, so in order to see the interesting Web sample application, you shoulddemo-base目录下面运行下面的命令:
> CD Jetty Extract folder/demo-base/> Java-jar. /start.jar 2016-02-24 13:56:35.939:warn::main:demo Test-realm is deployed. Do not use the in production!2016-02-24 13:56:35.943:info:oejs. Server:main:jetty-9-demo2016-02-24 13:56:35.976:INFO:OEJDP. ScanningAppProvider:main:Deployment Monitor [file:/home/user/jetty-distribution-9/demo-base/webapps/] at interval 12016-02-24 13:56:36.240:INFO:OEJPW. PlusConfiguration:main:No Transaction Manager Found-if Your webapp requires one, please configure one.2016-02-24 13:56: 36.732:warn::main:async-rest WebApp is deployed. Do not use in production! [...] 2016-02-24 13:56:38.572:info:oejsh. ContextHandler:main:Started [email protected]{/,file:/home/user/jetty-distribution-9/demo-base/webapps/ Root/,available}{/root}2016-02-24 13:56:38.579:info:oejs. ServerConnector:main:Started [email protected]{http/1.1}{0.0.0.0:8080}
Also enter http://localhost:8080 in the browser to access, will display the Welcome page and a few demo/test apps.
Tip: The Web sample application does not provide the necessary security measures, please do not publish to the production environment.
Create a new jetty Base
在Jetty 9中demo-base
The directory is an example based on the jetty.base mechanism, where a jetty.base allows the configuration file and the associated server instance to be saved separately in the jetty bundle. In order to upgrade with minimal loss. Jetty The default configuration is based on two related property configurations.
1.Jetty.home
-
The attributes he configures are jetty local bundles, default modules, default XML files (typically Start.jar, lib, etc)
- 2.jetty.base
-
The attributes he configures are instances, configurations, logs, and Web applications that are locally jetty defined (typically with Start.ini, START.D, logs, and WebApps)