Interface HttpBodyReleaser


@Internal public interface HttpBodyReleaser
Releases the body of an HTTP response which will not be consumed.

WellKnownProxyFilter uses it when it rejects an authorization server response instead of relaying it. Server-side HTTP implementations may hold on to the response body, for example as reference-counted buffers or an unread stream, until it is consumed or released. Dropping such a response without releasing it leaks memory and can keep the connection to the authorization server open.

The implementation depends on the HTTP runtime, so the filter looks up an optional bean of this type and does nothing when none is available, for example when Netty is absent.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    release(io.micronaut.http.HttpResponse<?> response)
    Releases the body of the given response.
  • Method Details

    • release

      void release(io.micronaut.http.HttpResponse<?> response)
      Releases the body of the given response. The response must not be read, relayed or released again afterwards.

      Implementations ignore responses they do not know how to release and must not throw.

      Parameters:
      response - The response whose body is discarded