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:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Iterable<java.nio.ByteBuffer>
,ContentProvider
,Callback
,Invocable
- Enclosing class:
- ProxyServlet
protected class ProxyServlet.ProxyInputStreamContentProvider extends InputStreamContentProvider
-
-
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
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ProxyInputStreamContentProvider(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, java.io.InputStream input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getLength()
protected java.nio.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(java.lang.Throwable failure)
Callback method invoked when an exception is thrown while reading from the stream.protected java.nio.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
-
-
-
-
Constructor Detail
-
ProxyInputStreamContentProvider
protected ProxyInputStreamContentProvider(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Request proxyRequest, java.io.InputStream input)
-
-
Method Detail
-
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
protected java.nio.ByteBuffer onRead(byte[] buffer, int offset, int length)
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 java.nio.ByteBuffer onRequestContent(javax.servlet.http.HttpServletRequest request, Request proxyRequest, byte[] buffer, int offset, int length)
-
onReadFailure
protected void onReadFailure(java.lang.Throwable failure)
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.
-
-