Introducing Brotli compression!

Thanks to the hard work of @nixxcode (LinkedIn), Javalin now has support for Brotli compression (in addition to the existing GZIP support).

The new setting deprecates the old dynamicGzip setting. You also get the option to change the compression level for both Brotli and Gzip. This can be done by adding an int specifying the compression level:

Javalin.create { config ->
    config.dynamicGzip = true // deprecated
    config.compressionStrategy(Brotli(4), Gzip(6))
}

The change also moves compression handling for static files from Jetty to Javalin, so static files compression can also be configured with the new setting.

To make all of this possible, the way responses are written in Javalin has been completely refactored. Please let us know if you notice anything out of the ordinary.

Misc fixes

  • MicroMeter is now easier to configure (thanks to @jon-ruckwood)
  • Fixed a bug where Pebble (template engine) would crash because of immutable maps (thanks to @hex-agon)
  • Fixed a bug in the getOrNull function on Validator (thanks to @oharaandrew314)
  • Fixed a bug in OpenAPI docs for Java method references (thanks to @TobiasWalle)
  • Made cookie-store cookie use root domain
  • Made cookie-store cookie renamable
  • Removed confusing log message when SessionHandler was configured with database
  • Fixed a bug where basic auth credentials couldn’t contain colons (thanks to @mikexliu)
  • A state variable for sharing state between the server and client has been introduced to VueComponent
  • Caching of VueComponents has been disabled

This release wouldn’t have been possible without contributions from the community, please head over to github.com/tipsy/javalin if you’re interested in contributing!