What’s new in Javalin 2.6: Server-side events, app extensions, and more!

Share
  • January 21, 2019

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.

Javalin updates

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.

Additionally, developers can now create app-extensions by calling app.register(appExtension). The Extension interface is another simple lambda. It’s inspired by the register function in Sinatra.

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 HttpResponseException exceptions
  • Added method for retrieving the request context path from Context
  • Javalin#addHandler is 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 EmbeddedJavalin
  • Static resource handling now has a ResourceHandler interface, 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 HttpResponseException

SEE MORE: Javalin 2.4 hits the spot for Kotlin and Java developers

Get Javalin

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!

The post What’s new in Javalin 2.6: Server-side events, app extensions, and more! appeared first on JAXenter.

Source : JAXenter