Javalin 2.0 supports WebJars web libraries, JSON modularization

Javalin 2.0 provides interoperability between Java and Kotlin.

Paul Krill Aug 27th 2018
time_clock_history_coffee_java_by_matthew_kerslake_cc0_via_unsplash_1200x800-100765108-orig.jpg

Version 2.0 of Javalin, a lightweight framework for the Java and Kotlin languages, is now shipping.

Supporting HTTP/2 and async requests, Javalin 2.0 provides interoperability between Java and Kotlin and is intended to be simple to use.

Changes made since the Version 1.7 release in May include:

  • Support for WebJars client-side web libraries.
  • Modularization of JSON and template functionality, so developers can plug in their own mappers/rendering engines.
  • The addition of a CRUDhandler to remove boilerplate from creating standard CRUD (create, read, update, delete) APIs.
  • Improved support for single-page applications.
  • Better exception handling for async requests.
  • The Pac4 security library.
  • Template functionality has been moved to a single ctx.render() function that uses the correct engine, based on file extension.
  • Rewritten WebSocket implementation.
  • Rewritten test suite.
  • A RequestLogger interface has been added.
  • Default values have been changed in some instances.
  • Functions return list instead of array.
  • Empty collections are returned instead of null.

Rather than being a full web framework, Javalin is a lightweight REST API library, or microframework. Although Javalin has no concept of MVC, its support of WebSockets, template engines, and static file-serving lets Javalin be used for building a RESTful API back end and serving index.html with static resources, if a developer is building a single-page application. To build a more traditional website, template engine wrappers can be used. The framework began as a fork of the Spark framework for Java and Kotlin but was rewritten, influenced by the Koa.js web framework.

Where to download Javalin

You can download Javalin from the project’s download page.