RFR: 8368955: Improve HttpExchange.sendResponseHeaders usability [v2]

Ethan McCue duke at openjdk.org
Fri Oct 3 05:31:45 UTC 2025


On Fri, 3 Oct 2025 05:00:50 GMT, Josiah Noel <duke at openjdk.org> wrote:

>> As specified in [JDK-8368955](https://bugs.openjdk.org/browse/JDK-8368955?jql=project%20in%20(JDK)%20AND%20component%20in%20(core-libs)%20AND%20Subcomponent%20in%20(java.net)), adds some constants to HttpExchange to make `sendResponseHeaders` more usable.
>
> Josiah Noel has updated the pull request incrementally with one additional commit since the last revision:
> 
>   pr comments

I hate to continue being the curmudgeon in the room, but I think this shares a lot of the downsides that #8331195 had.

Sorry on github that was #18955 

https://github.com/openjdk/jdk/pull/18955

This basically only solves for the very specific case of

1. You know, up front, that you are sending an empty response
2. You are aware these methods exist.

As an exercise, how would you write:


void sendStringResponse(HttpExchange exchange, int status, String body) {
    // ...
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/27613#issuecomment-3364310278
PR Comment: https://git.openjdk.org/jdk/pull/27613#issuecomment-3364315044


More information about the net-dev mailing list