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

Simplified error handling

Since the introduction of the standardized HTTP exceptions (like BadRequestResponse()), the app.error(status, handler) method has been less useful. Its main use now seems to be to render HTML error pages, so we’ve added an optional content-type to the method:

app.error(404, "html", my404PageHandler)

We’ve also made the ErrorHandler interface extend Handler, as it’s really the same interface. Because of backwards compatibility it can’t be removed, but all ErrorHandler instances are now valid Handler instances, and app.error() now takes a Handler.

Optional Brotli

In 3.2.0, we included include Brotli as a non-optional dependency, but due to how the Brotli artifact we depended on is published, this caused issues for some users (anyone using gradle).

As of 3.3.0, Brotli is an optional dependency, and we’ve also started work on creating a better Brotli wrapper for the JVM. This will hopefully be included in the next version of Javalin.

Bugfixes and test improvements

  • Fixed a bug in how responses are written, which caused issues when compressing responses larger than 64kb
  • Fixed a bug where certain files (images/audio/etc) were being compressed when they shouldn’t have been
  • Added Selenium and Chrome to the development test suite