A small example on how to use EventSource aka Server-Sent Events with Kotlin.
You need jetty-eventsource-servlet (released to Maven Central) then go to http://127.0.0.1:8080/kotlin-event-source-sample/ and you see the server time that gets updated all ten seconds. Not very useful but shows you how to use the API.
You need to have the JetBrains repository in your settings.xml
or proxy repository manager.
<repositories>
<repository>
<id>jetbrains-all</id>
<url>http://repository.jetbrains.com/all</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jetbrains-all</id>
<url>http://repository.jetbrains.com/all</url>
</pluginRepository>
</pluginRepositories>
To make the example work on Tomcat you need Tomcat 7 and have a NIO connector.
<Connector protocol="org.apache.coyote.http11.Http11NioProtocol" />
Check out the the HTTP Connector reference for more information.
It's recommended that you use Tomcat 7.0.28 or newer otherwise you'll get chunking.
Does chunking but works out of the box.
Needs a not yet released version or a manual patch, see GRIZZLY-1252
Works out of the box, even on Jetty 7.