RFR: 8331195: Improve com.sun.net.httpserver.HttpExchange usability [v6]

Jaikiran Pai jpai at openjdk.org
Mon Nov 10 11:28:04 UTC 2025


On Fri, 7 Nov 2025 14:34:50 GMT, Michael McMahon <michaelm at openjdk.org> wrote:

>> I'd like to return to this issue with a new PR that addresses the usability issue minimally. Namely to define numeric constants
>> for the counter-intuitive responseLength values in `HttpExchange.sendResponseHeaders`. The apidoc then refers to the constant names rather than the numeric values.
>> 
>> I've updated the implementation and some tests (though not all yet) to use the constant names. I'm open to suggestions on the names themselves. Once that is agreed, I'll update the remaining tests and any other call sites in the implementation.
>> 
>> Thanks,
>> Michael
>
> Michael McMahon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   updated remaining callsites for new constants

test/jdk/com/sun/net/httpserver/bugs/8300268/MaxIdleConnectionsTest.java line 136:

> 134:             System.out.println("Sending response for request " + exchange.getRequestURI() + " from " + exchange.getRemoteAddress());
> 135:             reqFinishedProcessing.countDown();
> 136:             exchange.sendResponseHeaders(200, RSPBODY_CHUNKED);

Should this use `RSPBODY_EMPTY` instead?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28132#discussion_r2510082331


More information about the net-dev mailing list