jetty / jetty.project

Eclipse Jetty® - Web Container & Clients - supports HTTP/2, HTTP/1.1, HTTP/1.0, websocket, servlets, and more
https://eclipse.dev/jetty
Other
3.78k stars 1.9k forks source link
eclipse embedded fcgi http http-client http-server http2 http2-push http3 https jakartaee java jetty jsp osgi servlet ssl tls unix-socket websockets

Eclipse Jetty

Eclipse Jetty is a lightweight, highly scalable, Java-based web server and Servlet engine. Jetty's goal is to support web protocols (HTTP/1, HTTP/2, HTTP/3, WebSocket, etc.) in a high volume low latency way that provides maximum performance while retaining the ease of use and compatibility with years of Servlet development. Jetty is a modern fully asynchronous web server that has a long history as a component oriented technology, and can be easily embedded into applications while still offering a solid traditional distribution for webapp deployment.

Webapp Example

$ mkdir jetty-base && cd jetty-base
$ java -jar $JETTY_HOME/start.jar --add-modules=http,ee10-deploy
$ cp ~/src/myproj/target/mywebapp.war webapps
$ java -jar $JETTY_HOME/start.jar 

Multiple Versions Webapp Example

$ mkdir jetty-base && cd jetty-base
$ java -jar $JETTY_HOME/start.jar --add-modules=http,ee10-deploy,ee8-deploy
$ cp ~/src/myproj/target/mywebapp10.war webapps
$ cp ~/src/myproj/target/mywebapp8.war webapps
$ echo "environment: ee8" > webapps/mywebapp8.properties
$ java -jar $JETTY_HOME/start.jar 

Embedded Jetty Example

Server server = new Server(port);
server.setHandler(new MyHandler());
server.start();

Embedded Servlet Example

Server server = new Server(port);
ServletContextHandler context = new ServletContextHandler("/");
context.addServlet(MyServlet.class, "/*");
server.setHandler(context);
server.start();

Building Jetty from Source

$ git clone https://github.com/jetty/jetty.project.git
$ cd jetty.project
$ mvn -Pfast clean install # fast build bypasses tests and other checks

For more detailed information on building and contributing to the Jetty project, please see the Contribution Guide.

Documentation

Jetty's documentation is available on the Eclipse Jetty website.

The documentation is divided into three guides, based on use case:

Commercial Support

Expert advice and production support of Jetty are provided by Webtide.