Package org.eclipse.jetty.proxy
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 org.eclipse.jetty.util.Callback
Callback.Completable, Callback.Completing, Callback.Nested
Nested classes/interfaces inherited from interface org.eclipse.jetty.client.api.ContentProvider
ContentProvider.Typed
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.thread.Invocable
Invocable.InvocationType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Request
private final javax.servlet.http.HttpServletRequest
private final javax.servlet.http.HttpServletResponse
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ProxyInputStreamContentProvider
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, InputStream input) -
Method Summary
Modifier and TypeMethodDescriptionlong
protected ByteBuffer
onRead
(byte[] buffer, int offset, int length) Callback method invoked just after having read from the stream, but before returning the iteration element (aByteBuffer
to the caller.protected void
onReadFailure
(Throwable failure) Callback method invoked when an exception is thrown while reading from the stream.protected ByteBuffer
onRequestContent
(javax.servlet.http.HttpServletRequest request, Request proxyRequest, byte[] buffer, int offset, int length) Methods inherited from class org.eclipse.jetty.client.util.InputStreamContentProvider
close, failed, iterator
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.client.api.ContentProvider
isReproducible
Methods inherited from interface org.eclipse.jetty.util.thread.Invocable
getInvocationType
Methods inherited from interface java.lang.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:
getLength
in interfaceContentProvider
- Overrides:
getLength
in classInputStreamContentProvider
- Returns:
- the content length, if known, or -1 if the content length is unknown
-
onRead
Description copied from class:InputStreamContentProvider
Callback method invoked just after having read from the stream, but before returning the iteration element (aByteBuffer
to 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:
onRead
in 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
ByteBuffer
wrapping 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:InputStreamContentProvider
Callback method invoked when an exception is thrown while reading from the stream.- Overrides:
onReadFailure
in classInputStreamContentProvider
- Parameters:
failure
- the exception thrown while reading from the stream.
-