What’s new in Javalin 2.6: Server-side events, app extensions, and more!
Things move fast in the Javalin world. With a release cycle that drops nearly every month, big things are happening. We check in to see what’s new, including server-side events, app extensions, and more!
Given the short release cycle, it’s not surprising that there are a few new things up Javalin’s sleeves!
Javalin is a potent yet lightweight mixture of Java and Kotlin. With a focus on simplicity and interoperability, Javalin is perfect for developers who need a flexible and lightweight framework for developing.
Server-side events have finally arrived, thanks to contributions from developers like you. (More specifically, thanks to @7agustibm and @firxworx. Cheers!) The syntax for these server-side events is lambda-based, much like many other Javalin APIs.
FYI: Server-sent events are also known as “EventSource”. This is especially useful for when you need to push events to clients to avoid polling.
As for single-page mode improvements, now developers can external files for their single-page entry points like
index.html. This entry point is no longer cached if the host is localhost.
Bugfixes and more
- Fixed a bug introduced in 2.5.0 which made “catch-all” exception-mappers interfere with
- Added method for retrieving the request context path from
Javalin#addHandleris now public
- Bumped Jetty
- Users can now call
ctx.resultString()in request loggers (after the response has been written).
- Users can now set the context-path in
- Static resource handling now has a
ResourceHandlerinterface, so users can utilize their own resource handler for extending Javalin
- An error is now logged if user attempts to read request body twice, and body is not cached
- Improved custom handling of
Want to try out Javalin 2.6 for yourself? This open source web framework is available on GitHub or here for download. Javalin is a true micro Java REST API library and has no external dependencies other than the embedded web-server, but it has plugins for JSON mapping and template rendering available if you need them.
Javalin is made possible through contributions from developers like you. If you’d like to help out, volunteer efforts are always welcome here!