Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328919 Add BodyHandlers / BodySubscribers methods to handle excessive server input
  3. JDK-8347910

Release Note: New Methods on BodyHandlers and BodySubscribers To Limit The Number of Response Body Bytes Accepted By The HttpClient

XMLWordPrintable

      Two new methods `java.net.http.HttpResponse.BodyHandlers.limiting(BodyHandler downstreamHandler, long capacity)` and `java.net.http.HttpResponse.BodySubsribers.limiting(BodySubscriber downstreamSubscriber, long capacity)` are added to the `HttpClient` API. These methods extend an existing `BodyHandler` or `BodySubscriber` with the ability to limit the number of response body bytes that the application is willing to accept in response to an HTTP request. Upon reaching the limit when reading the response body, an `IOException` will be raised and reported to the downstream subscriber. The subscription will be cancelled, and any further response body bytes will be discarded. This makes it possible for the application to control the maximum amount of bytes that it wants to accept from the server.

            vyazici Volkan Yazici
            vyazici Volkan Yazici
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: