On Fri, 14 Jun 2024 02:54:53 GMT, robert engels <d...@openjdk.org> wrote:

>> robert engels has updated the pull request incrementally with two additional 
>> commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'robaho/HttpExchange-api-change' into 
>> HttpExchange-api-change
>>    
>>    # Conflicts:
>>    # 
>> src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java
>>  - update api changes based on comments
>
> Are we not going to do anything with this?

@robaho Thanks for restarting the discussion. IMO the two constants are OK, but 
I don't think the new proposed methods have  gathered sufficient consensus to 
go in in this form yet.

Maybe we should brainstorm a bit more. For instance - we could rename the 
second parameter to sendResponseHeaders, and possibly rework the API 
documentation of that method.


public void sendResponseHeaders(int rCode, long lengthOrChunked);


then add 


public void sendHeadersForChunkedResponse(int rcode) {
    sendResponseHeaders(rCode, 0);
}

public void sendHeadersForFixedLengthResponse(int rcode, int responseLength) {
     if (responseLength < 0) throw new IllegalArgumentException("negative 
length: " + responseLength);
     sendResponseHeaders(rCode, responseLength == 0 ? -1 : responseLength);
}
 ``` 
 
 and:

-  add `@see` in `sendResponseHeaders` to link to the two new methods
- add an `@apiNote` to `sendResponseHeaders` to stress that using the other two 
methods is preferred.

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

PR Comment: https://git.openjdk.org/jdk/pull/18955#issuecomment-2167640579

Reply via email to