Clack backend for the JDK httpserver (inc. virtual threads)
Frederico Muñoz <[email protected]> Sun, 28 Jun 2026 21:09:47 +0100
| Newsgroups | gmane.editors.j.devel |
|---|---|
| Message-ID | <87qzlqqvec.fsf__7641.14787323109$1782679311$gmane$org@rigel.cyberobriga> |
Hello,
I've been working on different aspects of web develpment,=20
initially
centred on the Datastar hypermedia framework, but that soon=20
touches
other aspects: Server-Sent Events, compression, web server=20
support, and
the threading vs. event pool model.
I've written about this here:
https://interlaye.red/hypermedia_002dcommon_002dlisp.html
and wanted to share: it uses ABCL to create a Clack handler around
jdk.httpserver/sun.net.httpserver, and then uses
(java:jstatic "newVirtualThreadPerTaskExecutor"=20
"java.util.concurrent.Executors")
to start the Loom project / virtual threads. AFAIK (but I can be=20
wrong)
this is the first way to run Clack applications on a virtual=20
threads
backend (I write about the threaded and event loop models above.)
A live demo (which just shows connected and threads, so open more=20
tabs):
https://abcl-clack.lambda-combine.net/
Direct link to repository (still a WIP, there are calls and usage
patterns that are almost certainly rough or simply wrong):
https://codeberg.org/fsm/clack-handler-jdkhttp .
Thought this was the right place to share since ABCL is obviously=20
the
centrepiece in this - and happy for any feedback, of course.
All the best,
--=20
Frederico Mu=C3=B1oz
lambda combine