For educational purpose only
This is a very simple implementation of Servlet container.
Dependencies: IDE with maven, JDK 15
- Open project in your IDE
- Run edu.servletcontainer.binarycat.Main class
Dependencies: docker
- Place .war file to 'deploy' folder
- Install docker if you don't have it
- Build application: docker run -it --rm --name binary-cat --user $(id -u):$(id -g) -v ~/.m2/repository:/tmp/.m2/repository -v $(pwd):/usr/src/binary-cat -w /usr/src/binary-cat maven:3.6.3-openjdk-15 mvn clean package -Dmaven.repo.local=/tmp/.m2/repository
- Build docker image: docker build -t binary-cat .
- Run docker container: docker run -it --rm --cpus=1 --memory=64m -p 8080:8080 binary-cat
- Use your browser or curl to invoke servlet from your .war file. Servlet container is listening on port 8080.
- Look at the code and understand what it does.
- The code is as simple and straightforward as it could be. It has a bugs, spaghetti code, wrong exceptions handling, code duplicates, and etc. Find them and fix them.
- As you may see, Binary Cat does not cover all Servlet specification :-) Improve it.
There is a todo branch with some recommendations for assignments.