TinyWeb in Java
The Java version of TinyWeb is a basic MVC web framework written in a classic object-oriented style. To handle requests we use a Controller implemented using the Template method, which we cover in detail in Pattern 6, Replacing Template Method. Views are implemented using the Strategy pattern, covered in Pattern 7, Replacing Strategy.
Our framework is built around core pieces of data objects, HttpRequest and HttpResponse. We want these to be immutable and easy to work with, so we are going to build them using the Builder pattern discussed in Pattern 4, Replacing Builder for Immutable Object. Builder is a standard way of getting immutable objects in Java.
Finally, we’ve got request filters that run before a request is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access