https://github.com/ksm2/undertowplayground
An example project of Undertow using http2 with SSL and Jackson
https://github.com/ksm2/undertowplayground
docker http2 java json kotlin restful ssl undertow
Last synced: 2 months ago
JSON representation
An example project of Undertow using http2 with SSL and Jackson
- Host: GitHub
- URL: https://github.com/ksm2/undertowplayground
- Owner: ksm2
- Created: 2017-02-13T15:31:23.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T01:18:49.000Z (over 9 years ago)
- Last Synced: 2025-06-06T16:07:09.092Z (about 1 year ago)
- Topics: docker, http2, java, json, kotlin, restful, ssl, undertow
- Language: Kotlin
- Homepage:
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# UndertowPlayground
An example project of Undertow using http2 with SSL and Jackson
## Getting started
To build the project run
```bash
mvn clean package
```
Then build a container with docker
```bash
docker build -t undertow .
```
Create a docker network “undertowtest”
```bash
docker network create undertowtest
```
Start a MongoDB in “undertowtest”
```bash
docker run -d --name mongo --network-alias mongo --net undertowtest mongo
```
Start the Undertow server in “undertowtest”
```bash
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
```bash
cp src/main/resources/server.crt /etc/ca-certificates/trust-source/anchors/undertow.crt
trust expose-compat
```
Proceed to [/pet](https://localhost/pet) in your favourite Browser!
## Test RESTful API with cURL
```bash
# 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
```bash
docker rm -f undertow
```