Class ProxyServlet.ProxyInputStreamContentProvider
java.lang.Object
org.eclipse.jetty.client.util.InputStreamContentProvider
org.eclipse.jetty.proxy.ProxyServlet.ProxyInputStreamContentProvider
- All Implemented Interfaces:
Closeable, AutoCloseable, Iterable<ByteBuffer>, ContentProvider, Callback, Invocable
- Enclosing class:
ProxyServlet
-
Nested Class Summary
Nested classes/interfaces inherited from interface Callback
Callback.Completable, Callback.Completing, Callback.NestedNested classes/interfaces inherited from interface ContentProvider
ContentProvider.TypedNested classes/interfaces inherited from interface Invocable
Invocable.InvocationType -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Requestprivate final javax.servlet.http.HttpServletRequestprivate final javax.servlet.http.HttpServletResponseFields inherited from interface Invocable
__nonBlocking -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedProxyInputStreamContentProvider(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input) -
Method Summary
Modifier and TypeMethodDescriptionlongprotected ByteBufferonRead(byte[] buffer, int offset, int length) Callback method invoked just after having read from the stream, but before returning the iteration element (aByteBufferto the caller.protected voidonReadFailure(Throwable failure) Callback method invoked when an exception is thrown while reading from the stream.protected ByteBufferonRequestContent(javax.servlet.http.HttpServletRequest request, Request proxyRequest, byte[] buffer, int offset, int length) Methods inherited from class InputStreamContentProvider
close, failed, iteratorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentProvider
isReproducibleMethods inherited from interface Invocable
getInvocationTypeMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
response
private final javax.servlet.http.HttpServletResponse response -
proxyRequest
-
request
private final javax.servlet.http.HttpServletRequest request
-
-
Constructor Details
-
ProxyInputStreamContentProvider
protected ProxyInputStreamContentProvider(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input)
-
-
Method Details
-
getLength
public long getLength()- Specified by:
getLengthin interfaceContentProvider- Overrides:
getLengthin classInputStreamContentProvider- Returns:
- the content length, if known, or -1 if the content length is unknown
-
onRead
Description copied from class:InputStreamContentProviderCallback method invoked just after having read from the stream, but before returning the iteration element (aByteBufferto the caller.Subclasses may override this method to copy the content read from the stream to another location (a file, or in memory if the content is known to fit).
- Overrides:
onReadin classInputStreamContentProvider- Parameters:
buffer- the byte array containing the bytes readoffset- the offset from where bytes should be readlength- the length of the bytes read- Returns:
- a
ByteBufferwrapping the byte array
-
onRequestContent
protected ByteBuffer onRequestContent(javax.servlet.http.HttpServletRequest request, Request proxyRequest, byte[] buffer, int offset, int length) -
onReadFailure
Description copied from class:InputStreamContentProviderCallback method invoked when an exception is thrown while reading from the stream.- Overrides:
onReadFailurein classInputStreamContentProvider- Parameters:
failure- the exception thrown while reading from the stream.
-