Javalin 2.0 final release candidate is out – Info Java

Good afternoon /r/java ! For those who don’t know, Javalin is a lightweight Java and Kotlin web framework which focuses on simplicity and Java/Kotlin interoperability (read more on our website). We’re almost done with version 2.0, so we’re looking for some feedback/bug reports.

Download/feedback issue: https://github.com/tipsy/javalin/issues/280

Gitter chat: https://gitter.im/javalin-io/general

What’s changed since Javalin 1.7 ?

According to the gitlog, 180+ files have changed, with ~5000 additions and ~5500 deletions (which is more or less the entire code base). Most of the changes are internal; some abstraction layers have been removed and the WebSocket implementation has been completely rewritten.

Some of the major changes are:

We’ve added ETag support and a method for auto-generating ETags

We’ve added a RequestLogger interface ({ ctx, executionTime -> ...})

We’ve added the option to return 405 instead of 404, listing available methods for the path

We’ve added a set of default responses, so you can throw BadRequestResponse() (optional message)

We’ve added a CrudHandler to remove some boilerplate from creating standard CRUD APIs

We’ve added support for WebJars (https://www.webjars.org)

We’ve improved support for Single Page Applications

We’ve improved exception handling for async requests

All JSON and Template functionality has been modularized so you can easily plug in your own mappers/rendering engines.

All Template functionality has been moved into a single ctx.render() function which uses the correct engine based on the file extension

All requests run through an AccessManager now (but the default implementation is NOOP)

URL matching is now case-insensitive by default (call app.enableCaseSensitiveUrls() if you must)

Javalin now has a pac4j implementation (https://github.com/pac4j/javalin-pac4j)

Some default values have been changed

There are also a lot quality of life improvements, such as functions returning List instead of Array, returning empty collections instead of null, better default values and package structure, fixing visibility from Java, etc. Multiple bugs were hurt in the making of the new version.