Important: This news article covers an old version of Javalin (v2.1.1). The current version is v6.1.3.
See the documentation page for up-to-date information.

Nullable attributes

The following functions on the Context class are now correctly marked as nullable:

fun <T> attribute(attribute: String): T?
fun <T> attributeMap(): Map<String, T?>
fun <T> sessionAttribute(attribute: String): T?
fun <T> sessionAttributeMap(): Map<String, T?>

This change only affects Kotlin users.

Improved exception handling in async handlers

Javalin 2.0.0 introduced an exception handler for the CompletionException class. Unfortunately, this handler interfered with user-defined exception handlers. This has been fixed in 2.1.1. The default exception handler only handles CompletionException if the cause is a HttpResponseExceptions now.

Fixed encoding issues for json() and html() functions

The json() and html() functions on Context used to set the result stream before setting the content-type. This would lead to the result being written with the wrong encoding in some environments. This has been fixed.

Opening the Context class

The Context class is now open (not final anymore). This should make mocking easier for some mocking frameworks.