News

Javalin Framework for Kotlin and Java Updated

The latest release of Javalin, the lightweight Web framework for Kotlin and Java, is a minor, mostly bug-fix release, but the steady evolution and growing popularity of this open-source project are a kind of validation of this type minimalist framework.

A new version of Javalin has been released approximately twice a month (on average) since version 1.0 was released in November 2017. And all major releases have, so far, been backwards compatible.

This latest release adds a simple util class for rate limiting, letting devs call it in the beginning of their endpoint Handler functions. There's also a new plugin: RedirectToLowercasePathPlugin, designed to fill the void left by removing case-insensitive matching that was present in Javalin 2.x. The plugin redirects requests with uppercase/mixcase paths to lowercase paths. For example: /Users/Mary redirects to /users/Mary, if endpoint is /users/:userId. It doesn't affect the casing of path-params and query-params; just static URL fragments (Users becomes users above, but May remains Mary). When using this plugin, the documentation warns, you can only add paths with lowercase URL fragments.

Javalin first emerged as a fork the Spark Framework, another simple Java/Kotlin Web framework, but the project evolved quickly into a "ground-up rewrite" influenced by express.js, an unopinionated, minimalist web framework for Node.js. The framework runs on Eclipse Jetty, one of the most used and stable Web servers on the JVM.

Because Javalin was developed with compatibility in mind, the way it's used to build apps in Java and Kotlin are the same.

The popularity of Kotlin among Java developers has been growing steadily since JetBrains created and then open-sourced the statically typed programming language in 2011. The language compiles to both JVM byte code and JavaScript. JetBrains, the Prague-based maker of the venerable code-centric Java IDE IntelliJ IDEA, has claimed that Kotlin is more stable at runtime than Java, because it can statically check weak points and supports things like variable type interface, closures, extension functions, and mix-ins. It's also less verbose than Java, which means devs can write less code with a more readable syntax. During a memorable keynote demo at the 2017 Google I/O conference, Google's Android team showed an example of how Kotlin could accomplish in one line of code the same thing that required 87 lines of Java code.

The Javalin project code files and details are available on GitHub. A complete list of the changes can be found here.

About the Author

John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS.  He can be reached at [email protected].