Jetty Servlet Integration

Jetty Servlet Integration

Jetty has been developed 100% free and open source project from Eclipse foundation which provides functionality of web server. You can embed Jetty with your stand alone jar application project with using any application server. In this demo I will show you how to integrate Jetty with Servlet.

  • Create maven project name: JettyServletIntegration and full project structure is below:

Jetty Servlet Integration

  • pom.xml:

  • JettyServlet.java:

  • That’s it. Start JettyServer you will see below out put:

Jetty Servlet Integration

As you see Jetty server is started and it’s ready to serve the request. Now let’s create java http client who send one post request to Jetty Server also process response from Servlet:

  • HttpClientPost.java:

  • If you run HttpClientPost.java you will below which is request and processed response from server:

Jetty Servlet Integration

  • You could also test from other tools. I will be using Postman which is very good extension in Google Chrome to test HTTP functionality:

Jetty Servlet Integration

  • For more information please visit Eclipse Jetty here

download Download Project: JettyServletIntegration

Leave a Reply

Your email address will not be published. Required fields are marked *