/dyson_old

Demo how to build a RESTful stub server with Dropwizard

Primary LanguageJava

sample-dropwizard-rest-stub

This project is intended to demonstrate how to create RESTful server stub with Dropwizard as well as other All topics that this project is used for are:

Build

  • Install and configure Maven
  • Open cmd.exe and navigate to folder where project's pom.xml file is.
  • Build project and package JAR with following command

mvn clean package

Run

Run JAR with following command

java -jar target/sample-dropwizard-rest-stub-1.0-SNAPSHOT.jar server config.yml

Docker

  • Install Docker
  • Build Docker container with following command

docker build -t dropwizard-rest-stub .

  • Run Docker container with following command

docker run -it -p 9000:9000 -p 9001:9001 -e ENV_VARIABLE_VERSION=1.1.1 dropwizard-rest-stub

Functionalities

There are several functionalities implemented in the stub. See linked posts for more details how to use them.

Persons

Database where you can add, get or remove persons with JSON showing RESTful web services functionality described in Build a RESTful stub server with Dropwizard post. GET endpoints are: http://localhost:9000/person/all, http://localhost:9000/person/get/{id}, http://localhost:9000/person/remove. POST endpoint is: http://localhost:9000/person/save.

Books

Returns JSON list of books showing project Lombok functionality described in Get rid of Getters and Setters post. Endpoint is: http://localhost:9000/books

Secure Books

Returns JSON list of books showing authentication mechanism described in Implement secure API authentication over HTTP with Dropwizard post. Endpoint is: http://localhost:9000/secure/books

Products

Simple web page showing Servlet with Apache Velocity templates engine described in JPS alternative for Dropwizard – Servlet with Apache Velocity template engine post. Endpoint is: http://localhost:9000/products