Package io.undertow.io
Interface Receiver
-
- All Known Implementing Classes:
AsyncReceiverImpl
,BlockingReceiverImpl
public interface Receiver
Interface that provides an easy way to read data from the request. It is lambda compatible.- Author:
- Stuart Douglas
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Receiver.ErrorCallback
static interface
Receiver.FullBytesCallback
static interface
Receiver.FullStringCallback
static interface
Receiver.PartialBytesCallback
static interface
Receiver.PartialStringCallback
static class
Receiver.RequestToLargeException
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
pause()
When receiving partial data calling this method will pause the callbacks.void
receiveFullBytes(Receiver.FullBytesCallback callback)
Reads the request and invokes the callback when the request body has been fully read.void
receiveFullBytes(Receiver.FullBytesCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback when the request body has been fully read.void
receiveFullString(Receiver.FullStringCallback callback)
Reads the request and invokes the callback when the request body has been fully read.void
receiveFullString(Receiver.FullStringCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback when the request body has been fully read.void
receiveFullString(Receiver.FullStringCallback callback, Receiver.ErrorCallback errorCallback, java.nio.charset.Charset charset)
Reads the request and invokes the callback when the request body has been fully read.void
receiveFullString(Receiver.FullStringCallback callback, java.nio.charset.Charset charset)
Reads the request and invokes the callback when the request body has been fully read.void
receivePartialBytes(Receiver.PartialBytesCallback callback)
Reads the request and invokes the callback with request data.void
receivePartialBytes(Receiver.PartialBytesCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback with request data.void
receivePartialString(Receiver.PartialStringCallback callback)
Reads the request and invokes the callback with request data.void
receivePartialString(Receiver.PartialStringCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback with request data.void
receivePartialString(Receiver.PartialStringCallback callback, Receiver.ErrorCallback errorCallback, java.nio.charset.Charset charset)
Reads the request and invokes the callback with request data.void
receivePartialString(Receiver.PartialStringCallback callback, java.nio.charset.Charset charset)
Reads the request and invokes the callback with request data.void
resume()
Resumes paused callbacks.void
setMaxBufferSize(int maxBufferSize)
Sets the maximum amount of data that will be buffered in memory.
-
-
-
Method Detail
-
setMaxBufferSize
void setMaxBufferSize(int maxBufferSize)
Sets the maximum amount of data that will be buffered in memory. If you call a receiveFull* method and the request size is larger than this amount then the error callback with be invoked with aRequestTooBigException
.- Parameters:
maxBufferSize
- The maximum amount of data to be buffered
-
receiveFullString
void receiveFullString(Receiver.FullStringCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according toStandardCharsets.ISO_8859_1
. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on error
-
receiveFullString
void receiveFullString(Receiver.FullStringCallback callback)
Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according toStandardCharsets.ISO_8859_1
. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the request
-
receivePartialString
void receivePartialString(Receiver.PartialStringCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according toStandardCharsets.ISO_8859_1
. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on error
-
receivePartialString
void receivePartialString(Receiver.PartialStringCallback callback)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according toStandardCharsets.ISO_8859_1
. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the request
-
receiveFullString
void receiveFullString(Receiver.FullStringCallback callback, Receiver.ErrorCallback errorCallback, java.nio.charset.Charset charset)
Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to the specified charset. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on errorcharset
- The charset that is used to interpret the string
-
receiveFullString
void receiveFullString(Receiver.FullStringCallback callback, java.nio.charset.Charset charset)
Reads the request and invokes the callback when the request body has been fully read. This string will be interpreted according to the specified charset. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the requestcharset
- The charset that is used to interpret the string
-
receivePartialString
void receivePartialString(Receiver.PartialStringCallback callback, Receiver.ErrorCallback errorCallback, java.nio.charset.Charset charset)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to the specified charset. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on errorcharset
- The charset that is used to interpret the string
-
receivePartialString
void receivePartialString(Receiver.PartialStringCallback callback, java.nio.charset.Charset charset)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. This string will be interpreted according to the specified charset. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the requestcharset
- The charset that is used to interpret the string
-
receiveFullBytes
void receiveFullBytes(Receiver.FullBytesCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback when the request body has been fully read. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on error
-
receiveFullBytes
void receiveFullBytes(Receiver.FullBytesCallback callback)
Reads the request and invokes the callback when the request body has been fully read. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the request
-
receivePartialBytes
void receivePartialBytes(Receiver.PartialBytesCallback callback, Receiver.ErrorCallback errorCallback)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. If there is an error reading the request the error callback will be invoked.- Parameters:
callback
- The callback to invoke with the requesterrorCallback
- The callback that is invoked on error
-
receivePartialBytes
void receivePartialBytes(Receiver.PartialBytesCallback callback)
Reads the request and invokes the callback with request data. The callback may be invoked multiple times, and on the last time the last parameter will be true. If there is an error the exchange will be ended.- Parameters:
callback
- The callback to invoke with the request
-
pause
void pause()
When receiving partial data calling this method will pause the callbacks. Callbacks will not resume untilresume()
has been called.
-
resume
void resume()
Resumes paused callbacks.
-
-