Skip to content

janweinschenker/servlet4-demo

Repository files navigation

Build Status Coverage Status Codacy Badge

Servlet 4 Demo

This demo project is meant to show how to implement http2 servers and clients with Spring Boot 2.0.0M5 and Glassfish 5. All Implementation should utilize the Servlet4 library of JavaEE8.

The demo is a Maven mulit-module project that consists of these modules:

Module Description
client-jetty An http2 client implemented with Jetty's http client.
client-okhttp An http2 client implemented with spring boot 2 and OkHttp's http client.
client-httpcomponents An http2 client implemented with Apache HTTP components. This one will be made available as soon as version 5.0 of this library has been released.
server-glassfish An http2 servlet that runs on a Glassfish 5 application server. Will use local port 8181 for http2.
server-jetty An http2 rest controller that is implemented with spring boot 2 and Jetty's embedded http server. Will use local port 8447 for http2 and 8087 for http 1.1.
server-tomcat An http2 rest controller that is implemented with spring boot 2 and Tomcat's embedded http server. Will use local port 8449 for http2.
server-undertow An http2 rest controller that is implemented with spring boot 2 and Undertows's embedded http server. Will use local port 8448 for http2.
demo-util Common and utility stuff.

Requirements: needs Java 9

The following requirements must be met by your development environment:

  • Maven 3.3.9+
  • Java Development Kit 9
    • JAVA_HOME environment variable must be set to point to a JDK 9 installation.
  • Docker - required to run the Glassfish server.
  • Import the demo servers' TLS certificates into your local Java keystore.
    • Run this shell script:
    • ./server-jetty/script/import-server-cert.sh

Build this project

you@there:~/servlet4-demo$ mvn clean install

If you want to build this project without creating the docker container from module server-glassfish, use the no-docker profile:

you@there:~/servlet4-demo$ mvn clean install -P no-docker

Run the demos

Please refer to the readme files of the modules.

Maven profiles

Profile Description
no-docker Use this profile, if you don't want to create a Docker-image during the maven build. Currently, this only applies for the server-glassfish module, which requires a docker container to be built.
codacycoverage Send test coverage data for this project to codacy. This is only required, if this project is built on Travis CI. In Order to build with this profile. An some API tokens are needed.
coveralls Send test coverage data for this project to coveralls. This is only required, if this project is built on Travis CI. In Order to build with this profile. An some API tokens are needed.
sign Sign packages with gpg. Needs appropriate configuration in user's settings.xml.