Class ProxyServlet.ProxyInputStreamRequestContent
- All Implemented Interfaces:
Request.Content
,Content.Source
- Enclosing class:
- ProxyServlet
-
Constructor Summary
ModifierConstructorDescriptionprotected
ProxyInputStreamRequestContent
(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input) -
Method Summary
Methods inherited from class org.eclipse.jetty.client.InputStreamRequestContent
getContentType
Methods inherited from class org.eclipse.jetty.io.content.InputStreamContentSource
demand, fail, fillBufferFromInputStream, getBufferSize, isUseDirectByteBuffers, setBufferSize, setUseDirectByteBuffers
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.Content.Source
demand, fail, fail, rewind
-
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
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 nullContent.Chunk.getFailure()
, to signal that there was a failure trying to produce a chunk of content, or that the content production has beenfailed
externally - a
Content.Chunk
instance, containing the chunk of content.
Once a read returns an
Content.Chunk
instance with non-nullContent.Chunk.getFailure()
then if the failure islast
further reads will continue to return the same failure chunk instance, otherwise furtherread()
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 returnedContent.Chunk
.Additionally, prior to the ultimate call to
Retainable.release()
, the reader code may make additional calls toRetainable.retain()
, that must ultimately be matched by a correspondent number of calls toRetainable.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 interfaceContent.Source
- Overrides:
read
in classInputStreamContentSource
- Returns:
- a chunk of content, possibly a failure instance, or
null
- See Also:
-