RFR: 8331195: Improve com.sun.net.httpserver.HttpExchange usability [v5]
Michael McMahon
michaelm at openjdk.org
Thu Nov 6 13:28:06 UTC 2025
On Wed, 5 Nov 2025 15:17:35 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:
>
> update
I don't agree that you have to go looking for these constants. I think we have to look at it from the point of view of a developer new to the API and someone reading the apidoc for the first time will be clearly drawn to the constant names. I agree a new method with new parameter types would be nicer from an IDE perspective. But if we are going to add a new method then I think we are going to have a wider discussion such as occurred previously with this issue. So, even if we end up doing that and deprecating the present sendResponseHeaders() this effort is not going to get in the way of that.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28132#issuecomment-3497258616
More information about the net-dev
mailing list