This tutorial describes the usage of Maven for building Java applications.
1. What is Jetty?
Jetty is a web container. It has the following core components.
The current version of Jetty is Jetty 9 which supports the Servlet API 3.1.
[[installation_jetty] == Installation
Download Jetty from http://download.eclipse.org/jetty/ and extract the zip file somewhere to your filesystem.
This update site contains also a Eclipse p2 update site, in case you want to use Jetty in an OSGi environment.
2. Start Jetty from the JAR file
To start Jetty, switch on the command line to the installation directory and issue the following command.
java -jar start.jar
This starts Jetty on
To stop Jetty press Ctrl+C.
3. Using the HttpClient
The following code show a few examples of using the HttpClient of Jetty.
// Get a Client HttpClient httpClient = new HttpClient(); // Start server httpClient.start(); // do a get request ContentResponse response = httpClient .GET("http://www.vogella.com") .get(); // Issue a post request ContentResponse response = httpClient .POST("http://www.vogella.com/entity/1") .param("p", "value") .send() .get(5, TimeUnit.SECONDS);
4. Embedding Jetty in an Eclipse RCP application
Use Jetty in an Eclipse RCP application, add all Jetty plug-ins and the
javax.servlet plug-in as dependency to the MANIFEST.MF and the product.
See https://wiki.eclipse.org/Jetty/Tutorial/Embedding_Jetty for details.
5. About this website
6. Jetty resources
6.1. vogella GmbH training and consulting support
|TRAINING||SERVICE & SUPPORT|
The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.
The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.
Appendix A: Copyright and License
Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.