Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294196

Investigate introducing an API on the HttpClient which allows applications to get access to "interim" HTTP responses

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Unresolved
    • P4
    • None
    • None
    • core-libs
    • None

    Description

      HTTP RFC states that informational 1xx response codes are considered interim responses. https://bugs.openjdk.org/browse/JDK-8292044 fixed the HttpClient to not deliver such responses as final responses to applications.

      This current JBS issue is to investigate any new API on the HttpClient to allow applications to get access to such interim responses. The linked JBS proposed:

      "For the mainline we should probably add a new no-op method with an empty default body to the BodyHandler interface to give the caller a chance to intercept the 1xx response."

      Additionally in the PR discussion for the linked issue, one such proposed API looks like:


      > "Regarding a new API, maybe a method could be added to HttpResponse.BodyHandler to supply intermediate responses?"
      ...
      > I had a look at the HttpClient API and as you note, we could add a new method on BodyHandler to provide the application with these interim responses. Something like:
      >
      >/**
      >* Invoked when the client receives an interim informational (1xx) response for
      > * a request.
      > * @param responseInfo The interim response
      > */
      > default void applyInterim(ResponseInfo responseInfo) {
      > // do nothing by default
      > }

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jpai Jaikiran Pai
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: