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

Custom jetty handlers

Javalin 1.2.0 introduces the possibility of adding custom jetty handlers, such as StatisticsHandler and RequestLogHandler.
You can configure your embedded jetty-server with a handler-chain (example), and Javalin will attach it’s own handlers to the end of this chain.

  • Kotlin
  • Java
val statisticsHandler = StatisticsHandler()

Javalin.create().apply {
        Server(queuedThreadPool).apply {
            handler = statisticsHandler
StatisticsHandler statisticsHandler = new StatisticsHandler();

    .embeddedServer(new EmbeddedJettyFactory(() -> {
        Server server = new Server();
        return server;

Doing this will allow you to integrate Javalin with for example prometheus easily, by exposing statistics collected by the StatisticsHandler.
There’s even a tutorial to show you how that’s done: /tutorials/prometheus-example

EventManager cleanup

There was a bug in the Event data class, where properties were declared as var instead of val. The Javalin val was nullable for no apparent reason, so that’s been fixed too.

Kotlin 1.2.0

Kotlin has been bumped to 1.2.0