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

Improved response handling and logging

Javalin previously used a PrintWriter to write responses, while Jetty copied to the response OutputStream. For logging, Javalin used a custom PrintWriter that would copy the response, but this would not catch responses written by Jetty (static files). Javalin now uses a custom OutputStream for response-logging, so every response (both Javalin and Jetty-handled) is logged.

Request-logger no longer includes the body of multipart-requests.

Static resource improvements

  • GZIP has been enabled
  • Cache-control is now set to max-age=0 by default, which means that clients will always ask Jetty if files have been updated - unless:
  • If you put files in a dir called immutable, then max-age will be set to one year. This should only be used for versioned library files, like vue-2.4.2.min.js

New functions on Context

  • ctx.renderMarkdown("/path/to/markdown-file.md") - render and serve a markdown-file
  • ctx.isMultipart() check if request is multipart