Package org.eclipse.jetty.server
Class HttpOutput.ReadableByteChannelWritingCB
- java.lang.Object
-
- org.eclipse.jetty.util.IteratingCallback
-
- org.eclipse.jetty.server.HttpOutput.ChannelWriteCB
-
- org.eclipse.jetty.server.HttpOutput.NestedChannelWriteCB
-
- org.eclipse.jetty.server.HttpOutput.ReadableByteChannelWritingCB
-
- Enclosing class:
- HttpOutput
private class HttpOutput.ReadableByteChannelWritingCB extends HttpOutput.NestedChannelWriteCB
An iterating callback that will take content from a ReadableByteChannel and write it to theHttpChannel
. AByteBuffer
of sizeHttpOutput.getBufferSize()
is used that will be direct ifHttpChannel.useDirectBuffers()
is true. This callback is passed to theHttpChannel.write(ByteBuffer, boolean, Callback)
to be notified as each buffer is written and only once all the input is consumed will the wrappedCallback.succeeded()
method be called.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.util.IteratingCallback
IteratingCallback.Action
-
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.util.thread.Invocable
Invocable.InvocationType
-
-
Field Summary
Fields Modifier and Type Field Description private java.nio.ByteBuffer
_buffer
private boolean
_closed
private boolean
_eof
private java.nio.channels.ReadableByteChannel
_in
-
Fields inherited from class org.eclipse.jetty.server.HttpOutput.ChannelWriteCB
_last
-
Fields inherited from interface org.eclipse.jetty.util.thread.Invocable
__nonBlocking
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ReadableByteChannelWritingCB(java.nio.channels.ReadableByteChannel in, Callback callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onCompleteFailure(java.lang.Throwable x)
Invoked when the overall task has completed with a failure.protected IteratingCallback.Action
process()
Method called byIteratingCallback.iterate()
to process the asynchronous sub-task.-
Methods inherited from class org.eclipse.jetty.server.HttpOutput.NestedChannelWriteCB
getInvocationType, onCompleteSuccess
-
Methods inherited from class org.eclipse.jetty.util.IteratingCallback
close, failed, isClosed, isFailed, isSucceeded, iterate, reset, succeeded, toString
-
-
-
-
Constructor Detail
-
ReadableByteChannelWritingCB
private ReadableByteChannelWritingCB(java.nio.channels.ReadableByteChannel in, Callback callback)
-
-
Method Detail
-
process
protected IteratingCallback.Action process() throws java.lang.Exception
Description copied from class:IteratingCallback
Method called byIteratingCallback.iterate()
to process the asynchronous sub-task.Implementations must initiate the asynchronous execution of the sub-task (if any) and return an appropriate action:
IteratingCallback.Action.IDLE
when no sub tasks are available for execution but the overall job is not completed yetIteratingCallback.Action.SCHEDULED
when the sub task asynchronous execution has been startedIteratingCallback.Action.SUCCEEDED
when the overall job is completed
- Specified by:
process
in classIteratingCallback
- Returns:
- the appropriate Action
- Throws:
java.lang.Exception
-
onCompleteFailure
public void onCompleteFailure(java.lang.Throwable x)
Description copied from class:IteratingCallback
Invoked when the overall task has completed with a failure.- Overrides:
onCompleteFailure
in classHttpOutput.NestedChannelWriteCB
- Parameters:
x
- the throwable to indicate cause of failure- See Also:
IteratingCallback.onCompleteSuccess()
-
-