Interface Request.Content

All Known Implementing Classes:
AbstractRequestContent, AsyncRequestContent, ByteBufferRequestContent, BytesRequestContent, FormRequestContent, InputStreamRequestContent, MultiPartRequestContent, OutputStreamRequestContent, PathRequestContent, ProxyServlet.ProxyInputStreamRequestContent, RequestContentAdapter, StringRequestContent
Enclosing interface:
Request

public static interface Request.Content

A reactive model to produce request content, similar to Flow.Publisher.

Implementations receive the content consumer via subscribe(Consumer, boolean), and return a Request.Content.Subscription as the link between producer and consumer.

Content producers must notify content to the consumer only if there is demand.

Content consumers can generate demand for content by invoking Request.Content.Subscription.demand().

Content production must follow this algorithm:

  • the first time content is demanded
    • when the content is not available => produce an empty content
    • when the content is available:
      • when emitInitialContent == false => produce an empty content
      • when emitInitialContent == true => produce the content
  • the second and subsequent times content is demanded
    • when the content is not available => do not produce content
    • when the content is available => produce the content
See Also: