RFR: 8331195: Improve com.sun.net.httpserver.HttpExchange usability [v4]
Michael McMahon
michaelm at openjdk.org
Thu Jun 20 09:18:16 UTC 2024
On Sat, 15 Jun 2024 03:22:47 GMT, Ethan McCue <duke at openjdk.org> wrote:
> To reiterate, I'm still not the biggest fan of the constant names given
>
> * The parameter name they are being used for is `responseLength`. "The responseLength is CHUNKED_CONTENT" feels jank and `lengthOrChunked` doesn't inspire joy.
>
> * I'm not convinced the audience that we presumably care the most about for this API won't be helped too much by them
There's nothing we can do about the fact that what is a 'length' parameter also conveys the usage of content encoding. I think the biggest win this change can achieve (for the least impact) is to reduce the easy to make error of using the value `0` to mean zero length. I agree it's not ideal that the constants have CONTENT in their name. But, the alternative of using something like LENGTH would see us define a constant like this `public static final int ZERO_LENGTH = -1;` which would provoke even more confusion (if not worse) imo.
I suggest we stick with the constant names but refer to them explicitly in the apidoc for sendResponseHeaders along the lines I suggested above.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18955#issuecomment-2180206341
More information about the net-dev
mailing list