public interface AsyncHandle
A class to handle the request and response handling when using asynchronous request handling.
To asynchronously read the request body, see setReadListener(RequestBodyListener)
. To
write data, this interface provides asynchronous write operations, or alternatively you can use the
blocking write operations on the original MuResponse
.
Modifier and Type | Interface and Description |
---|---|
static interface |
AsyncHandle.ResponseCompletedListener
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
void |
addResponseCompleteHandler(ResponseCompleteListener responseCompleteListener)
Add a listener for when request processing is complete.
|
void |
complete()
Call this to indicate that the response is complete.
|
void |
complete(Throwable throwable)
Call this to indicate that the response is complete.
|
void |
setReadListener(RequestBodyListener readListener)
Sets a listener that will be notified when chunks of request data become available.
|
void |
setResponseCompletedHandler(AsyncHandle.ResponseCompletedListener responseCompletedListener)
Deprecated.
|
void |
setResponseCompleteHandler(ResponseCompleteListener responseCompleteListener)
Deprecated.
|
Future<Void> |
write(ByteBuffer data)
Writes data to the response asynchronously.
|
void |
write(ByteBuffer data,
DoneCallback callback)
Writes data to the response asynchronously.
|
void |
write(ByteBuffer data,
WriteCallback callback)
Deprecated.
Use
write(ByteBuffer, DoneCallback) instead |
void setReadListener(RequestBodyListener readListener)
Sets a listener that will be notified when chunks of request data become available.
If this is not set, then the usual (blocking) request reading methods on the request object can be used.
readListener
- The listener.void complete()
void complete(Throwable throwable)
If the throwable
parameter is not null then the error will be logged and, if possible,
a 500 Internal Server Error
message will be sent to the client.
throwable
- an exception to log, or null if there was no problem@Deprecated void write(ByteBuffer data, WriteCallback callback)
write(ByteBuffer, DoneCallback)
insteadWrites data to the response asynchronously.
Note that even in async mode it is possible to use the blocking write methods on the MuResponse
See write(ByteBuffer)
for an alternative that returns a future.
data
- The data to writecallback
- The callback when the write succeeds or failsvoid write(ByteBuffer data, DoneCallback callback)
Writes data to the response asynchronously.
Note that even in async mode it is possible to use the blocking write methods on the MuResponse
See write(ByteBuffer)
for an alternative that returns a future.
data
- The data to writecallback
- The callback when the write succeeds or failsFuture<Void> write(ByteBuffer data)
Writes data to the response asynchronously.
Note that even in async mode it is possible to use the blocking write methods on the MuResponse
See write(ByteBuffer, DoneCallback)
for an alternative that uses a callback.
data
- The data to write@Deprecated void setResponseCompleteHandler(ResponseCompleteListener responseCompleteListener)
addResponseCompleteHandler(ResponseCompleteListener)
insteadresponseCompleteListener
- The handler to invoke when the request is complete.void addResponseCompleteHandler(ResponseCompleteListener responseCompleteListener)
responseCompleteListener
- The handler to invoke when the request is complete.@Deprecated void setResponseCompletedHandler(AsyncHandle.ResponseCompletedListener responseCompletedListener)
addResponseCompleteHandler(ResponseCompleteListener)
insteadresponseCompletedListener
- The handler to invoke when the request is complete.Copyright © 2017–2021. All rights reserved.