2 ms·
The JDK has a server-as-a-function-ish web server built in (and has done for years): https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/com/sun/
by twic 4y ago
The JDK has a server-as-a-function-ish web server built in (and has done for years):
https://docs.oracle.com/en/java/javase/17/docs/api/jdk.httpserver/com/sun/net/httpserver/package-summary.html https://docs.oracle.com/en/java/javase/17/docs/api/jdk.https...
Because HttpHandler is a functional interface, you can write lambdas for it. Here is a little outline of a server:
https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c455235c756354 https://gist.github.com/tomwhoiscontrary/b4888b86057c74a636c...
Sadly, Filter is not a functional interface, so it's much clunkier. It's also not really clear why you would use a filter when you can do function composition; i suspect they added filters because previous Java web frameworks had them.