|Javalin 2.0 Released|
|Written by Kay Ewbank|
|Tuesday, 04 September 2018|
A very lightweight web framework for Kotlin and Java has been updated to version 2.0. Javalin supports WebSockets, HTTP2 and async requests.
The developers say that Javalin’s main goals are simplicity, a great developer experience, and first class interoperability between Kotlin and Java. It is described as more library than framework:
"you don’t need to extend anything, there are no @Annotations, no reflection, no other magic; just code."
Javalin was inspired by Sparkjava and koa.js. It is written in Kotlin with a few functional interfaces written in Java, and it runs on the Eclipse Jetty web server. The JSON mapper is pluggable, so Javalin supports any and all JSON-mapping libraries. There is an optional Jackson implementation included, but you can also choose to create your own mapper.
The recent release has a wide range of improvements, starting with the addition of ETag support and a method for auto-generating ETags. Entity Tags are HTTP headers that are used to validate Web caches, and to cache unchanged resources.
Support has been added for WebJars client-side web libraries. These are client-side libraries such as jQuery and Bootstrap packaged into Java Archive (JAR) files. The libraries can then be used to manage the client-side dependencies in JVM-based web applications.
The JSON and template support in Javalin has been modularized in this release making it possible to plug in your own choice of rendering engines and mappers. More generally, template functionality has been moved to a single function that uses the correct engine based on the file extension.
A new CRUDhandler has been added that implements the five most common crud operations (create, read all, read one, update, delete). The new handler is designed to remove boilerplate code when creating standard CRUD APIs.
The new release has better support for single-page applications, and better exception handling for async requests.
The WebSocket implementation and the test suite have been re-written, and an implementation of the Pac4 security library has been included.
The developers say there are also a lot quality of life improvements, such as functions returning
or email your comment to: firstname.lastname@example.org