Important: This news article covers an old version of Javalin (v4.0.0 (ALPHA)).
The current version is v6.7.0.
See the documentation page for up-to-date information.
See the documentation page for up-to-date information.
4.0 discussion
Please write your feature requests on GitHub.
4.0.0.ALPHA4 (15th of July)
- New routing! Path parms have been changed from
:paramto{param}, and a new syntax has been introduced to allow path params with slashes (<param>). This also makes it possible to create paths like/{p1}AND{p2}, or/{filename}.{extension}. - All reified methods on
Contexthave been brought back with theasClasssuffix (ex.ctx.queryParamAsClass<Int>("key")) - Static
JavalinJsonis gone, replaced byconfig.jsonMapper(jsonMapper) - Added streaming methods to
JsonMapper, these are optional methods for reducing memory usage - The
sessionAttribute("key" consume = true)method has been renamed toconsumeSessionAttribute("key") - Added a
Pluginfor setting security headers - You can now set custom errors for async timeouts
- Fixed context-path bug in MicroMeter plugin
- Added missing
@JvmOverloadstoHttpResponseException - The
Contextargument is now optional inFileRenderer - A ton of internal refactoring
ALPHA4 is intended to be the last alpha release of Javalin 4, next up is RC0!
4.0.0.ALPHA3 (22nd of June)
- Added
cachedSessionAttributemethod toContext, which caches session-attributes as request-attributes. - The
removeCookiemethod inContextnow uses/as the default path - the
HandlerTypeof a handler is now available in theContext - Validation has been completely reworked
- Route declarations now take
Role...instead ofSet<Role - Attributes on
Javalinnow have the same signature as attributes onContext - The
Context#result(Future)andContext#json(Future)methods have been replace byContext#future(Future)andContext#future(Future, Consumer). The consumer runs after the future has completed and accepts the result of the future as an argument. There is a defaultConsumerwhich makesContext#futurework identical to bothContext#result(Future)andContext#json(Future)from Javalin 3 - Fixed a bug in OpenAPI with schema annotations for
Instantnot working - Fixed wrong error message if there was a port collision between a custom Jetty Server and a default Jetty server
- Jetty’s
TimeoutExceptions are now ignored instead of logged as error - The
CorsPluginnow sets theVaryheader - The default port is now
8080to align with other JVM frameworks - The default server no longer sends the
Serverheader
4.0.0.ALPHA2 (26th of May)
- A new module with test tools has been added (
javalin-testtools) - see API in PR - A Loom ThreadPool (virtual threads) is now used by default (if runtime has Loom)
- Kotlin has been bumped to 1.5.0, and tests now run against JDK 15
- Static-files config has been reworked. All global config options have been removed, and it’s now possible to set headers per handler. The “immutable” folder convention has been removed
- You can now consume a session attribute by passing a boolean (
ctx.sessionAttribute(key = "key", consume = true)) - JavalinVue’s configuration has been reworked, it’s no longer possible to set things in the wrong order
- Added a
JavalinLoggerto easily enable/disable all of Javalin’s logging - GraphQL now supports operation names
- The
cookie(name, value)method will now set instead of add (meaning you can no longer end up with two cookies with the same name) - The included rate-limiter has been renamed to
NaiveRateLimiter, to further underline its limits - The Javalin version is now logged on startup
Javalin#confighas been renamed toJavalin#_confto avoid people accidentally using it
4.0.0.ALPHA1 (18th of April)
- You can now validate empty strings in
Validator - Content-Type can now be null for
UploadedFile WsHandleris nowWsConfig- Context extensions (
Context#register/Context#use) have been removed - JavalinVue now supports Vue3
- Exceptions while writing responses in async mode are now handled gracefully
- Can now set explicit “includes” in OpenAPI (ex:
.includePath("/api") - Added option to log Jetty info during startup
- Removed dependency on Jetty from OpenAPI plugin
4.0.0.ALPHA0 (17th of February)
This version is very similar to 3.13.3 (the last 3x version).
There is one breaking change, which is the extraction of inline reified functions from Context and WsContext.
These functions lead to non-deterministic behavior in Mockk and Mockito, which made it hard to write mock tests.
Jackson has been bumped to 2.12.1, which actually required bumping to Kotlin 1.4 too.
The HttpResponseException class now properly serializes the details map to an object, rather than an array of key/value pairs.