Skip to end of metadata
Go to start of metadata

什么是 Jetty

Jetty是一个提供HTTP服务器,HTTP客户端,和 javax.servlet 容器的开源项目。

这个指南被分为下面 5 个部分:

  • 第一部分: 开始使用 Jetty 注重于 Jetty 的开始使用。在这部分提供的内容包括有,Jetty 是什么,到哪里可以下载到 Jetty,到哪里可以找到 Jetty 的 Maven 仓库链接。同时还提供了如何让 Jetty 启动并且运行,Jetty 的配置总览的内容。
  • 第二部分:Jetty 配置指南 注重于更加细致的配置 Jetty。在这部分解释了,如何使用 Jetty 部署 Web 应用程序,配置上下文和链接,如何实现 SSL 等其他安全特性。
  • Administration of Jetty is the focus of the third section of the guide. From server startup to session management, logging, HTTP/2 support and Jetty optimization, these chapters will help administrators get the most out of their Jetty server instances. This section also covers configuring many of the most common servlet container features such as JNDI and JMX.
  • Aimed at advanced users of Jetty, the fourth section of the guide focuses on Jetty development. A large portion of this section is focused on using Jetty as an embedded server in existing applications. It contains several examples and how-to guides for making the most out of the Jetty framework. This section also includes a guide on using the Jetty Maven plugin as well as information on debugging Jetty.
  • The final section of the guide is a reference section. Included there are guides on Jetty architecture and Jetty XML syntax, alternate distributions of Jetty and even troubleshooting of common issues. There is also a chapter on getting involved in the Jetty community including information on how to contribute code and how to find help.

请随时对我们的内容进行反馈。如果你有兴趣如何参与开源项目,请参考 Contributing to Jetty 中的内容。

针对本中文手册,请直接在页面中评论,或者在本 WIKI 中添加问题。

本页中的内容:

相关页面:

我应该使用 Jetty 的那个版本?

Jetty 9 是最新的版本,针对以前的 Jetty 版本,Jetty 9 进行了很多的改进。本文档也主要是针对 Jetty 9 的。

如果你还在使用其他老的 Jetty 版本,Jetty 官方建议你尽快升级到 Jetty 9, Jetty 9 的版本,官方还计划维护几年的时间,Jetty 7 和 8 官方已经不在进行任何维护和升级了。

在生产环境中只使用稳定版本是非常重要的。我们已经不在使用的版本,或者 M 版本(released as Milestones)RC 版本(Release Candidates)都不建议在生产环境上使用,因为这些版本中可能有隐藏的安全问题,没有完全实现或者不能完全工作的的特性等问题。


Jetty 版本

版本主页JVM协议ServletJSP状态

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是否可插拔

JSR 340

Servlet 规范 API 3.1


JSR 344

Java Server Faces 2.2 (JSF)

是, Mojarra 或 MyFaces

JSR 245 / JSR 341

Java Server Pages 2.3/Java 表达式语言 3.0 (JSP/EL)

JSR 52

Java 标准标签库 1.2 (JSTL)

JSR 45

其它语言的调试支持 1.0

是 (通过 JSP)

是 (通过 JSP)

JSR 346

Java EE 平台的Contexts和依赖注入 1.1(Web Beans)

是, Weld

JSR 330

Java依赖注入 1.0

是(作为CDI实现的一部分, Weld

JSR 316

可管理的Beans 1.0

是(作为其它技术的一部分)

JSR 345

企业 JavaBeans 3.2 Lite


JSR 338

Java 持久化 2.1 (JPA)

是(例如 Hibernate)

JSR 250

Java平台的通用注解1.2

部分(非核心Servlet规范注解)

JSR 907

Java 事务 API 1.2 (JTA)

JSR 349

Bean 验证 1.1

作为其它技术(JSF)的一部分,或者一个独立的实现,比如 Hiberate Validator

JSR 339

Java API for RESTful Web Services 2.0 (JAX-RS)


JSR 356

Java API for Websocket 1.0

JSR 353

JSON 处理 Java API 1.0(JSON-P)

是(JSON-P 参考实现

JSR 318

拦截器 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

JSRNameIncluded with jetty-9.0.xPluggable

JSR 315

Servlet Specification API 3.0


JSR 314

JavaServer Faces 2.0 (JSF)

是, for example, Mojarra or MyFaces

JSR 245

JavaServer Pages 2.2/Java Expression Language 2.2 (JSP/EL)

JSR 52

Java Standard Tag Library 1.2 (JSTL)

JSR 45

Debugging Support for Other Languages 1.0

是 (via JSP)

是 (via JSP)

JSR 299

Contexts and Dependency Injection for the Java EE Platform 1.0 (Web Beans)

是, Weld or OpenWebBeans

JSR 330

Dependency Injection for Java 1.0

是 as part of a CDI implementation, Weld

JSR 316

Managed Beans 1.0

是, as part of a否ther tech否logy.

JSR 318

Enterprise JavaBeans 3.1

是, OpenEJB

JSR 317

Java Persistance 2.0 (JPA)

是, Hibernate

JSR 250

Common An否tations for the Java Platform

Partially (for 否n-core Servlet Spec an否tations)

JSR 907

Java Transaction API (JTA)

Implementations are pluggable, such as AtomikosJOTMJencks (Geronimo Transaction Manager)

JSR 303

Bean Validation 1.0

是 as part of a否ther tech否logy (JSF), or a stand-alone implementation such as Hiberate Validator

在 Maven 中找到 Jetty


Maven 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>


  • No labels