Eclipse Jetty extension
Introduction
This connector is based on the Eclipse Jetty open-source web server. Jetty is popular alternative to Tomcat developed by WebTide and has a nice separation between its HTTP protocol implementation and its support for the Servlet API which led to the first HTTP server connector developed for the Restlet Framework.
Description
This connector supports the following protocols: HTTP (with or without TLS, aka HTTPS), HTTP2 (with or without TLS), HTTP3 on the server-side and client-side.
The list of supported specific parameters is available in the javadocs:
- Jetty server common parameters
- HTTP server specific parameters
- HTTPS server specific parameters
- Jetty client common parameters
Here is the list of dependencies of this connector:
For additional details, please consult the Javadocs.
Usage example
Please consult connector configuration documentation
HTTPS
For general information on Jetty HTTPS/SSL configuration, please read this document. For configuration of the connector in a Restlet component, you will need to set some of the HTTPS parameters listed above, for example:
Server server = myComponent.getServers().add(Protocol.HTTPS, 8183);
server.getContext().getParameters().add("keystorePath", "<your-path>");
server.getContext().getParameters().add("keystorePassword", "<your-password>");
server.getContext().getParameters().add("keyPassword", "<your-password>");
HTTP2, HTTP3 on server side
The support for HTTP2 and HTTP3 is disabled by default. In order to use it, you need to complete the server configuration.
There are two cases, according you are configuring a HTTP or a HTTP server
HTTP server
In this case, HTTP3 is not supported. Just provide the HTTP2
value to the http.transport.mode
to the server’s configuration.
Server server = myComponent.getServers().add(Protocol.HTTP, 8182);
server.getContext().getParameters().add("http.transport.mode", "HTTP2");
HTTP1.1 will be still be supported.
HTTPS server
In this case, HTTP3 is supported. The http.transport.protocols
parameter allows to specify the list of protocol versions supported.
Server server = myComponent.getServers().add(Protocol.HTTPS, 8183);
server.getContext().getParameters().add("http.transport.protocols", "HTTP1_1,HTTP2,HTTP3");
HTTP2, HTTP3 on client side
In this case, you can either ask to support only HTTP1.1, HTTP2, HTTP3, or support all of them using the DYNAMIC value, as follow:
CLient client = myComponent.getClient().add(Protocol.HTTPS);
client.getContext().getParameters().add("httpClientTransportMode", "DYNAMIC");