Interface StreamBody

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface StreamBody
Produces a streamed response body (see Response.stream(int, java.lang.String, com.jsgalactic.axiom.http.StreamBody)). The runtime calls writeTo(com.jsgalactic.axiom.http.BodyWriter) once, on the virtual thread that ran the handler and after the response head was sent, so the request keeps its admission slot and deadline until the body returns. The response ends when the method returns normally. An exception, including a StreamAbortedException from a write, abandons it: the connection is closed without a second response, because the head was already sent.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Writes the body.
  • Method Details

    • writeTo

      void writeTo(BodyWriter out) throws Exception
      Writes the body.
      Parameters:
      out - destination, valid until this method returns
      Throws:
      Exception - to abandon the response