Simple Example in README (#6727)

* Simple Example in README

Simple Example in README

* updates from review
This commit is contained in:
Greg Wilkins 2021-09-09 11:32:16 +10:00 committed by GitHub
parent e7294c5fda
commit 0b0c231597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -18,6 +18,24 @@ Jetty is a modern fully async web server that has a long history as a component
- [https://projects.eclipse.org/projects/rt.jetty](https://projects.eclipse.org/projects/rt.jetty)
Webapp Example
--------------
```shell
$ mkdir base && cd base
$ java -jar $JETTY_HOME/start.jar --add-modules=http,deploy
$ cp ~/src/myproj/target/mywebapp.war webapps
$ java -jar $JETTY_HOME/start.jar
```
Embedded Example
----------------
```java
Server server = new Server(port);
ServletContextHandler context = new ServletContextHandler(server, "/");
context.addServlet(MyServlet.class, "/*");
server.start();
```
Documentation
-------------