Does anyone have context on jdk.httpserver?
Ethan McCue
ethan at mccue.dev
Sun Jan 21 20:18:09 UTC 2024
Hi all,
Elliot[1] and I have been digging into the HTTP(S) server implementation
provided by the jdk.httpserver module.
It hasn't taken long to notice that the provided implementation
is...lacking. Both in performance, as it places extremely low and errors
out on benchmarks [2][3], and in polish, as doing relatively simple tasks
like printing out the result of HttpExchange#getRequestHeaders() does not
actually include the headers in the output.
But, the actual API isn't wretched. The overall design (with a Filter chain
and a mutable "out" object for responses) is reminiscent of Servlets and
there is an SPI hook to provide custom server implementations. And unlike
the jwebserver tool, which is built on this, there isn't a "for education
purposes only" sign anywhere and it is part of an exported and supposedly
supported module.
All that is to ask - does anyone on this mailing list have any historical
context on this? Why was it added to the JDK, what were the goals of its
implementation, are there any records of the decision process behind its
design?
Separately is there any appetite for improving the performance of the
built-in server implementation?
[1]: https://github.com/ebarlas/microhttp
[2]:
https://www.techempower.com/benchmarks/#hw=ph&test=plaintext§ion=data-r22
[3]:
https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Java/httpserver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20240121/960ed173/attachment.htm>
More information about the core-libs-dev
mailing list