RFR: 8328919: Add BodyHandlers / BodySubscribers methods to handle excessive server input

Chen Liang liach at openjdk.org
Tue Jan 14 09:08:37 UTC 2025


On Tue, 14 Jan 2025 08:51:55 GMT, Volkan Yazıcı <duke at openjdk.org> wrote:

> Adds `limiting()` factory methods to `HttpResponse.Body{Handlers,Subscribers}` to handle excessive server input in `HttpClient`. I would appreciate your input whether `discardExcess` should be kept or dropped. I plan to file a CSR once there is an agreement on the PR.

src/java.net.http/share/classes/java/net/http/HttpResponse.java line 760:

> 758:          * @param discardExcess if {@code true}, excessive input will be discarded; otherwise, it will throw an exception
> 759:          * @throws IllegalArgumentException if {@code capacity < 0}
> 760:          */

Suggestion:

         * @since 25
         */

Same for the new factory in `BodySubscribers`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23096#discussion_r1914454528


More information about the net-dev mailing list