我应该使用 Jetty 的那个版本?
Jetty 9 是最新的版本,针对以前的 Jetty 版本,Jetty 9 进行了很多的改进。本文档也主要是针对 Jetty 9 的。
如果你还在使用其他老的 Jetty 版本,Jetty 官方建议你尽快升级到 Jetty 9, Jetty 9 的版本,官方还计划维护几年的时间,Jetty 7 和 8 官方已经不在进行任何维护和升级了。
Warning |
---|
在生产环境中只使用稳定版本是非常重要的。我们已经不在使用的版本,或者 M 版本(released as Milestones)RC 版本(Release Candidates)都不建议在生产环境上使用,因为这些版本中可能有隐藏的安全问题,没有完全实现或者不能完全工作的的特性等问题。 |
Jetty 版本
版本 | 年 | 主页 | JVM | 协议 | Servlet | JSP | 状态 |
---|---|---|---|---|---|---|---|
9.4 | 2016 | Eclipse | 1.8 | HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI | 3.1 | 2.3 | 稳定(Stable) |
9.3 | 2015 | Eclipse | 1.8 | HTTP/1.1 (RFC 7230), HTTP/2 (RFC 7540), WebSocket (RFC 6455, JSR 356), FastCGI | 3.1 | 2.3 | 稳定(Stable) |
9.2 | 2014 | Eclipse | 1.7 | HTTP/1.1 RFC2616, javax.websocket, SPDY v3 | 3.1 | 2.3 | 稳定(Stable) |
8 | 2009-2014 | Eclipse/Codehaus | 1.6 | HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 | 3.0 | 2.2 | 丢弃(Deprecated) |
7 | 2008-2014 | Eclipse/Codehaus | 1.5 | HTTP/1.1 RFC2616, WebSocket RFC 6455, SPDY v3 | 2.5 | 2.1 | 丢弃(Deprecated) |
6 | 2006-2010 | Codehaus | 1.4-1.5 | HTTP/1.1 RFC2616 | 2.5 | 2.0 | 丢弃(Deprecated) |
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 | - | - | 神话(Mythical) |
Jetty 和 Java EE Web Profile
Jetty实现了Java EE 规范,主要是Servlet规范.Java EE 平台的最近版本介绍了Web Profile,意识到许多开发者在Java EE 范围内只需要许多技术的一个子集.
当然Jetty自身并不是所有的Web Profile技术,Jetty是这样的一种架构:你可以插入第三方实现,产生一个符合你的确切需求的自定义的容器.
Java EE 7 Web Profile
在即将发布的Java EE 7 规范中,Web Profile的更新反映在它的组件规范和加入的一些新的:
JavaEE7 Web Profile
JSR | 名称 | 是否包含在 Jetty-9.1.x | 是否可插拔 |
---|---|---|---|
Servlet 规范 API 3.1 | 是 | ||
Java Server Faces 2.2 (JSF) | 否 | ||
Java Server Pages 2.3/Java 表达式语言 3.0 (JSP/EL) | 是 | 是 | |
Java 标准标签库 1.2 (JSTL) | 是 | 是 | |
其它语言的调试支持 1.0 | 是 (通过 JSP) | 是 (通过 JSP) | |
Java EE 平台的Contexts和依赖注入 1.1(Web Beans) | 否 | 是, Weld | |
Java依赖注入 1.0 | 否 | 是(作为CDI实现的一部分, Weld) | |
可管理的Beans 1.0 | 否 | 是(作为其它技术的一部分) | |
企业 JavaBeans 3.2 Lite | 否 | ||
Java 持久化 2.1 (JPA) | 否 | 是(例如 Hibernate) | |
Java平台的通用注解1.2 | 是 | 部分(非核心Servlet规范注解) | |
Java 事务 API 1.2 (JTA) | 是 | 是 | |
Bean 验证 1.1 | 否 | 作为其它技术(JSF)的一部分,或者一个独立的实现,比如 Hiberate Validator | |
Java API for RESTful Web Services 2.0 (JAX-RS) | 否 | ||
Java API for Websocket 1.0 | 是 | 否 | |
JSON 处理 Java API 1.0(JSON-P) | 否 | 是(JSON-P 参考实现) | |
拦截器 1.2 | 否 | 是 (作为CDI实现的一部分) |
Jetty EE 6 Web Profile
Here is the matrix of JSRs for Java EE 6 Web Profile, and how they relate to Jetty:
Table 1.3. Java EE 6 Web Profile
JSR | Name | Included with jetty-9.0.x | Pluggable |
---|---|---|---|
Servlet Specification API 3.0 | 是 | ||
JavaServer Faces 2.0 (JSF) | 否 | ||
JavaServer Pages 2.2/Java Expression Language 2.2 (JSP/EL) | 是 | 是 | |
Java Standard Tag Library 1.2 (JSTL) | 是 | 是 | |
Debugging Support for Other Languages 1.0 | 是 (via JSP) | 是 (via JSP) | |
Contexts and Dependency Injection for the Java EE Platform 1.0 (Web Beans) | 否 | 是, Weld or OpenWebBeans | |
Dependency Injection for Java 1.0 | 否 | 是 as part of a CDI implementation, Weld | |
Managed Beans 1.0 | 否 | 是, as part of a否ther tech否logy. | |
Enterprise JavaBeans 3.1 | 否 | 是, OpenEJB | |
Java Persistance 2.0 (JPA) | 否 | 是, Hibernate | |
Common An否tations for the Java Platform | 是 | Partially (for 否n-core Servlet Spec an否tations) | |
Java Transaction API (JTA) | 是 | Implementations are pluggable, such as Atomikos, JOTM, Jencks (Geronimo Transaction Manager) | |
Bean Validation 1.0 | 否 | 是 as part of a否ther tech否logy (JSF), or a stand-alone implementation such as Hiberate Validator |
在 Maven 中找到 Jetty
in MavenMaven CoordinatesChangelogs in Maven Central
Important
It is important that only stable releases are used in production environments. Versions that have been deprecated or are released as Milestones (M) or Release Candidates (RC) are 否t suitable for production as they may contain security flaws or incomplete/否n-functioning feature sets.
Maven Coordinates
Jetty has existed in Maven Central almost since its inception, though the coordinates have changed over the years. When Jetty was based at SourceForge and then The Codehaus it was located under the groupId
of org.mortbay.jetty
. With Jetty 7 the project moved to the Eclipse foundation and to a new groupId
at that time to reflect its new home.
The top level Project Object Model (POM) for the Jetty project is located under the following coordinates.
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>${project.version}</version>
</dependency>
Changelogs in Maven Central
The changes between versions of Jetty are tracked in a file called VERSIONS.txt, which is under source control and is generated on release. Those generated files are also uploaded into Maven Central during the release of the top level POM. You can find them as a classifier marked artifact.
http://central.maven.org/maven2/org/eclipse/jetty/jetty-project/
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
<version>${project.version}</version>
<classifier>version</classifier>
<type>txt</type>
</dependency>