Class ProxyServlet.ProxyInputStreamRequestContent

All Implemented Interfaces:
Request.Content, Content.Source
Enclosing class:
ProxyServlet

protected class ProxyServlet.ProxyInputStreamRequestContent extends InputStreamRequestContent
  • Constructor Details

    • ProxyInputStreamRequestContent

      protected ProxyInputStreamRequestContent(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input)
  • Method Details

    • getLength

      public long getLength()
      Returns:
      the content length, if known, or -1 if the content length is unknown
    • read

      public Content.Chunk read()
      Description copied from interface: Content.Source

      Reads a chunk of content.

      See how to use this method idiomatically.

      The returned chunk could be:

      • null, to signal that there isn't a chunk of content available
      • an Content.Chunk instance with non null Content.Chunk.getFailure(), to signal that there was a failure trying to produce a chunk of content, or that the content production has been failed externally
      • a Content.Chunk instance, containing the chunk of content.

      Once a read returns an Content.Chunk instance with non-null Content.Chunk.getFailure() then if the failure is last further reads will continue to return the same failure chunk instance, otherwise further read() operations may return different non-failure chunks.

      Once a read returns a last chunk, further reads will continue to return a last chunk (although the instance may be different).

      The content reader code must ultimately arrange for a call to Retainable.release() on the returned Content.Chunk.

      Additionally, prior to the ultimate call to Retainable.release(), the reader code may make additional calls to Retainable.retain(), that must ultimately be matched by a correspondent number of calls to Retainable.release().

      Concurrent reads from different threads are not recommended, as they are inherently in a race condition.

      Reads performed outside the invocation context of a demand callback are allowed. However, reads performed with a pending demand are inherently in a race condition (the thread that reads with the thread that invokes the demand callback).

      Specified by:
      read in interface Content.Source
      Overrides:
      read in class InputStreamContentSource
      Returns:
      a chunk of content, possibly a failure instance, or null
      See Also: