Skip to content

Commit 4fd306f

Browse files
committed
Merge remote-tracking branch 'origin/jetty-12.0.x' into jetty-12.0.x-VirtualThreadPoolSemaphore
2 parents 8464340 + 0f28d47 commit 4fd306f

File tree

21 files changed

+538
-64
lines changed

21 files changed

+538
-64
lines changed

documentation/jetty/modules/ROOT/pages/index.adoc

+25-3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,34 @@
1313

1414
= Eclipse Jetty {page-version}
1515

16-
This section of the site contains the documentation for {page-component-title} {page-version}.
16+
This is the main documentation page for the Eclipse Jetty Project.
17+
18+
Jetty provides a highly scalable and memory-efficient web server and Servlet container, supporting web protocols such as HTTP/1.1, HTTP/2, HTTP/3 and WebSocket.
19+
Furthermore, Jetty offers integrations with many other technologies, such as OSGi, JMX, JNDI, JAAS, CDI, etc. and with the relevant Jakarta EE technologies.
20+
21+
Jetty is open source and are freely available for commercial use and distribution under either the link:https://www.eclipse.org/legal/epl-2.0/[Eclipse Public License v2] or the link:https://www.apache.org/licenses/LICENSE-2.0[Apache License v2].
22+
23+
Jetty can either be used as a standalone server to deploy web applications, or as a library that can be used in your code as a dependency.
24+
25+
.Jetty Versions and Compatibilities
26+
[cols="1a,1a,1a,1a", options="header"]
27+
|===
28+
| Jetty Version | Required Java Version | Jakarta EE Version | Status
29+
| Jetty 12.1.x | Java 17 | Jakarta EE11, EE10, EE9, EE8 | Development
30+
31+
| Jetty 12.0.x | Java 17 | Jakarta EE10, EE9, EE8 | Stable
32+
33+
| Jetty 11.0.x | Java 11 | Jakarta EE9 | EOL (see link:https://github.com/jetty/jetty.project/issues/10485[#10485])
34+
35+
| Jetty 10.0.x | Java 11 | Jakarta EE8 | EOL (see link:https://github.com/jetty/jetty.project/issues/10485[#10485])
36+
37+
| Jetty 9.4.x | Java 8 | Jakarta EE7 | EOL (see link:https://github.com/jetty/jetty.project/issues/7958[#7958])
38+
|===
1739

1840
== xref:operations-guide:index.adoc[]
1941

20-
The Eclipse Jetty Operations Guide targets sysops, devops, and developers who want to install Eclipse Jetty as a standalone server to deploy web applications.
42+
The Operations Guide targets sysops, devops, and developers who want to install Jetty as a standalone server to deploy web applications.
2143

2244
== xref:programming-guide:index.adoc[]
2345

24-
The Eclipse Jetty Programming Guide targets developers who want to use the Eclipse Jetty libraries in their applications, and advanced sysops/devops that want to customize the deployment of web applications.
46+
The Programming Guide targets developers who want to use the Jetty libraries in their applications, and advanced sysops/devops that want to customize the deployment of web applications.

documentation/jetty/modules/code/examples/src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java

+28
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.io.IOException;
1818
import java.io.InputStream;
1919
import java.io.OutputStream;
20+
import java.net.SocketAddress;
2021
import java.net.URI;
2122
import java.nio.ByteBuffer;
2223
import java.nio.file.Path;
@@ -34,6 +35,7 @@
3435
import org.eclipse.jetty.client.BufferingResponseListener;
3536
import org.eclipse.jetty.client.BytesRequestContent;
3637
import org.eclipse.jetty.client.CompletableResponseListener;
38+
import org.eclipse.jetty.client.Connection;
3739
import org.eclipse.jetty.client.ConnectionPool;
3840
import org.eclipse.jetty.client.ContentResponse;
3941
import org.eclipse.jetty.client.Destination;
@@ -72,6 +74,7 @@
7274
import org.eclipse.jetty.io.ClientConnectionFactory;
7375
import org.eclipse.jetty.io.ClientConnector;
7476
import org.eclipse.jetty.io.Content;
77+
import org.eclipse.jetty.io.EndPoint;
7578
import org.eclipse.jetty.io.Transport;
7679
import org.eclipse.jetty.io.ssl.SslHandshakeListener;
7780
import org.eclipse.jetty.quic.client.ClientQuicConfiguration;
@@ -1180,4 +1183,29 @@ public void mixedTransports() throws Exception
11801183
.send();
11811184
// end::mixedTransports[]
11821185
}
1186+
1187+
public void connectionInformation() throws Exception
1188+
{
1189+
// tag::connectionInformation[]
1190+
HttpClient httpClient = new HttpClient();
1191+
httpClient.start();
1192+
1193+
ContentResponse response = httpClient.newRequest("http://domain.com/path")
1194+
// The connection information is only available starting from the request begin event.
1195+
.onRequestBegin(request ->
1196+
{
1197+
Connection connection = request.getConnection();
1198+
1199+
// Obtain the address of the server.
1200+
SocketAddress remoteAddress = connection.getRemoteSocketAddress();
1201+
System.getLogger("connection").log(INFO, "Server address: %s", remoteAddress);
1202+
1203+
// Obtain the SslSessionData.
1204+
EndPoint.SslSessionData sslSessionData = connection.getSslSessionData();
1205+
if (sslSessionData != null)
1206+
System.getLogger("connection").log(INFO, "SslSessionData: %s", sslSessionData);
1207+
})
1208+
.send();
1209+
// end::connectionInformation[]
1210+
}
11831211
}

documentation/jetty/modules/programming-guide/pages/client/http.adoc

+28-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ A second request with the same origin sent _after_ the first request/response cy
235235
A second request with the same origin sent _concurrently_ with the first request will likely cause the opening of a second connection, depending on the connection pool implementation.
236236
The configuration parameter `HttpClient.maxConnectionsPerDestination` (see also the <<configuration,configuration section>>) controls the max number of connections that can be opened for a destination.
237237

238-
NOTE: If opening connections to a given origin takes a long time, then requests for that origin will queue up in the corresponding destination until the connections are established.
238+
[NOTE]
239+
====
240+
If opening connections to a given origin takes a long time, then requests for that origin will queue up in the corresponding destination until the connections are established.
241+
242+
To save the time spent opening connections, you can xref:connection-pool-precreate-connections[pre-create connections].
243+
====
239244

240245
Each connection can handle a limited number of concurrent requests.
241246
For HTTP/1.1, this number is always `1`: there can only be one outstanding request for each connection.
@@ -528,6 +533,28 @@ This is a fancy example of how to mix HTTP versions and low-level transports:
528533
include::code:example$src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java[tag=mixedTransports]
529534
----
530535

536+
[[connection-information]]
537+
=== Request Connection Information
538+
539+
In order to send a request, it is necessary to obtain a connection, as explained in the xref:request-processing[request processing section].
540+
541+
The HTTP/1.1 protocol may send only one request at a time on a single connection, while multiplexed protocols such as HTTP/2 may send many requests at a time on a single connection.
542+
543+
You can access the connection information, for example the local and remote `SocketAddress`, or the `SslSessionData` if the connection is secured, in the following way:
544+
545+
[,java,indent=0]
546+
----
547+
include::code:example$src/main/java/org/eclipse/jetty/docs/programming/client/http/HTTPClientDocs.java[tag=connectionInformation]
548+
----
549+
550+
[NOTE]
551+
====
552+
The connection information is only available when the request is associated with a connection.
553+
554+
This means that the connection is not available in the _request queued_ event, but only starting from the _request begin_ event.
555+
For more information about request events, see xref:non-blocking[this section].
556+
====
557+
531558
[[configuration]]
532559
== HttpClient Configuration
533560

documentation/jetty/modules/programming-guide/pages/index.adoc

+21
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,24 @@ You may use the xref:client/index.adoc[Jetty client-side library] in your applic
2323
Likewise, you may use the xref:server/index.adoc[Jetty server-side library] to quickly create an HTTP or REST service without having to create a web application archive file (a `+*.war+` file) and without having to deploy it to a Jetty standalone server that you would have to download and install.
2424

2525
This guide will walk you through the design of the Jetty libraries and how to use its classes to write your applications.
26+
27+
== Code Deprecation Policy
28+
29+
As the Jetty code evolves, classes and/or methods are deprecated using the `@Deprecated` annotation and will be removed in a future Jetty release.
30+
31+
The Jetty release numbering follows this scheme: `<major>.<minor>.<micro>`. For example, 12.0.5 has `major=12`, `minor=0` and `micro=5`.
32+
33+
As much as possible, deprecated code is not removed in micro releases.
34+
Deprecated code may be removed in major releases.
35+
Deprecated code may be removed in minor releases, but only if it has been deprecated for at least 6 micro releases.
36+
37+
For example, let's assume that Jetty 12.1.0 (a new minor release) is released after the release of Jetty 12.0.11.
38+
39+
Then, code that was deprecated in Jetty 12.0.5 or earlier may be removed from Jetty 12.1.0 (because it has been deprecated for more than 6 micro releases).
40+
41+
On the other hand, code that was deprecated in Jetty 12.0.8 may be removed in Jetty 12.1.3 (because it has been deprecated for 3 micro releases in Jetty 12.0.x, and for 3 micro releases in Jetty 12.1.x -- 12.1.0, 12.1.1 and 12.1.2).
42+
43+
[NOTE]
44+
====
45+
There could be rare cases where code (possibly not even deprecated) must be removed earlier than specified above to address security vulnerabilities.
46+
====

jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/Connection.java

+10
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import java.io.Closeable;
1717
import java.net.SocketAddress;
1818

19+
import org.eclipse.jetty.io.EndPoint;
1920
import org.eclipse.jetty.util.Promise;
2021

2122
/**
@@ -63,4 +64,13 @@ default SocketAddress getRemoteSocketAddress()
6364
{
6465
return null;
6566
}
67+
68+
/**
69+
* @return the {@link EndPoint.SslSessionData} associated with
70+
* the connection, or {@code null} if the connection is not secure.
71+
*/
72+
default EndPoint.SslSessionData getSslSessionData()
73+
{
74+
return null;
75+
}
6676
}

jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/HttpProxy.java

+6
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ public SocketAddress getRemoteSocketAddress()
346346
return connection.getRemoteSocketAddress();
347347
}
348348

349+
@Override
350+
public EndPoint.SslSessionData getSslSessionData()
351+
{
352+
return connection.getSslSessionData();
353+
}
354+
349355
@Override
350356
public void send(Request request, Response.CompleteListener listener)
351357
{

jetty-core/jetty-client/src/main/java/org/eclipse/jetty/client/transport/internal/HttpConnectionOverHTTP.java

+12
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ public SocketAddress getRemoteSocketAddress()
116116
return delegate.getRemoteSocketAddress();
117117
}
118118

119+
@Override
120+
public EndPoint.SslSessionData getSslSessionData()
121+
{
122+
return delegate.getSslSessionData();
123+
}
124+
119125
@Override
120126
public long getBytesIn()
121127
{
@@ -350,6 +356,12 @@ public SocketAddress getRemoteSocketAddress()
350356
return getEndPoint().getRemoteSocketAddress();
351357
}
352358

359+
@Override
360+
public EndPoint.SslSessionData getSslSessionData()
361+
{
362+
return getEndPoint().getSslSessionData();
363+
}
364+
353365
@Override
354366
public SendFailure send(HttpExchange exchange)
355367
{

jetty-core/jetty-fcgi/jetty-fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/transport/internal/HttpConnectionOverFCGI.java

+12
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,12 @@ public SocketAddress getRemoteSocketAddress()
101101
return delegate.getRemoteSocketAddress();
102102
}
103103

104+
@Override
105+
public EndPoint.SslSessionData getSslSessionData()
106+
{
107+
return delegate.getSslSessionData();
108+
}
109+
104110
protected Flusher getFlusher()
105111
{
106112
return flusher;
@@ -359,6 +365,12 @@ public SocketAddress getRemoteSocketAddress()
359365
return getEndPoint().getRemoteSocketAddress();
360366
}
361367

368+
@Override
369+
public EndPoint.SslSessionData getSslSessionData()
370+
{
371+
return getEndPoint().getSslSessionData();
372+
}
373+
362374
@Override
363375
public SendFailure send(HttpExchange exchange)
364376
{

jetty-core/jetty-http2/jetty-http2-client-transport/src/main/java/org/eclipse/jetty/http2/client/transport/internal/HttpConnectionOverHTTP2.java

+7
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import org.eclipse.jetty.http2.api.Session;
4545
import org.eclipse.jetty.http2.api.Stream;
4646
import org.eclipse.jetty.http2.frames.HeadersFrame;
47+
import org.eclipse.jetty.io.EndPoint;
4748
import org.eclipse.jetty.util.Callback;
4849
import org.eclipse.jetty.util.thread.Sweeper;
4950
import org.slf4j.Logger;
@@ -85,6 +86,12 @@ public SocketAddress getRemoteSocketAddress()
8586
return session.getRemoteSocketAddress();
8687
}
8788

89+
@Override
90+
public EndPoint.SslSessionData getSslSessionData()
91+
{
92+
return connection.getEndPoint().getSslSessionData();
93+
}
94+
8895
public boolean isRecycleHttpChannels()
8996
{
9097
return recycleHttpChannels;

jetty-core/jetty-http2/jetty-http2-client/src/main/java/org/eclipse/jetty/http2/client/HTTP2ClientConnectionFactory.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ private HTTP2ClientConnection(HTTP2Client client, EndPoint endpoint, HTTP2Client
9595
public void onOpen()
9696
{
9797
Map<Integer, Integer> settings = listener.onPreface(getSession());
98-
if (settings == null)
99-
settings = new HashMap<>();
98+
settings = settings == null ? new HashMap<>() : new HashMap<>(settings);
10099

101100
// Below we want to populate any settings to send to the server
102101
// that have a different default than what prescribed by the RFC.

jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java

+5
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,11 @@ protected Entry(Frame frame, HTTP2Stream stream, Callback callback)
12481248
this.stream = stream;
12491249
}
12501250

1251+
public Frame frame()
1252+
{
1253+
return frame;
1254+
}
1255+
12511256
public abstract int getFrameBytesGenerated();
12521257

12531258
public int getDataBytesRemaining()

0 commit comments

Comments
 (0)