Class ProxyServlet.ProxyInputStreamRequestContent
- All Implemented Interfaces:
Request.Content,Content.Source
- Enclosing class:
- ProxyServlet
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Content.Source
Content.Source.Factory -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProxyInputStreamRequestContent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input) -
Method Summary
Methods inherited from class org.eclipse.jetty.client.InputStreamRequestContent
getContentTypeMethods inherited from class org.eclipse.jetty.io.content.InputStreamContentSource
demand, fail, fillBufferFromInputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.jetty.io.Content.Source
demand, fail, fail, rewind
-
Constructor Details
-
ProxyInputStreamRequestContent
protected ProxyInputStreamRequestContent(javax.servlet.http.HttpServletRequest request, javax.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.SourceReads 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.Chunkinstance 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 beenfailedexternally - a
Content.Chunkinstance, containing the chunk of content.
Once a read returns an
Content.Chunkinstance with non-nullContent.Chunk.getFailure()then if the failure islastfurther 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 callbackare 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:
readin interfaceContent.Source- Overrides:
readin classInputStreamContentSource- Returns:
- a chunk of content, possibly a failure instance, or
null - See Also:
-