ksm2 / UndertowPlayground

An example project of Undertow using http2 with SSL and Jackson

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UndertowPlayground

An example project of Undertow using http2 with SSL and Jackson

Getting started

To build the project run

mvn clean package

Then build a container with docker

docker build -t undertow .

Create a docker network “undertowtest”

docker network create undertowtest

Start a MongoDB in “undertowtest”

docker run -d --name mongo --network-alias mongo --net undertowtest mongo

Start the Undertow server in “undertowtest”

docker run -d -p 443:8443 --name undertow --network-alias undertow --net undertowtest  undertow

Add the SSL certificate to your trusted certificates. On Arch Linux you do that by running

cp src/main/resources/server.crt /etc/ca-certificates/trust-source/anchors/undertow.crt
trust expose-compat

Proceed to /pet in your favourite Browser!

Test RESTful API with cURL

# Post a new pet called “herby”
curl --cacert src/main/resources/server.crt -X POST -d '{"name":"herby","age":42}' https://localhost/pet
# Get Herby
curl --cacert src/main/resources/server.crt -X GET https://localhost/pet/herby
# Update Herby
curl --cacert src/main/resources/server.crt -X PUT -d '{"name":"herby","age":23}' https://localhost/pet/herby
# Increase Herby's age
curl --cacert src/main/resources/server.crt -X POST https://localhost/pet/herby/increaseAge
# Remove Herby
curl --cacert src/main/resources/server.crt -X DELETE https://localhost/pet/herby

Stop it

docker rm -f undertow

About

An example project of Undertow using http2 with SSL and Jackson


Languages

Language:Kotlin 100.0%