public abstract class AbstractListenerReadPublisher<T> extends Object implements org.reactivestreams.Publisher<T>
Publisher
implementations that bridge between
event-listener read APIs and Reactive Streams.
Specifically a base class for reading from the HTTP request body with Servlet 3.1 non-blocking I/O and Undertow XNIO as well as handling incoming WebSocket messages with standard Java WebSocket (JSR-356), Jetty, and Undertow.
Constructor and Description |
---|
AbstractListenerReadPublisher() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
checkOnDataAvailable() |
void |
onAllDataRead()
Listeners can call this to notify when all data has been read.
|
void |
onDataAvailable()
Listeners can call this to notify when reading is possible.
|
void |
onError(Throwable t)
Listeners can call this to notify when a read error has occurred.
|
protected abstract T |
read()
Reads a data from the input, if possible.
|
void |
subscribe(org.reactivestreams.Subscriber<? super T> subscriber) |
protected final Log logger
public void subscribe(org.reactivestreams.Subscriber<? super T> subscriber)
subscribe
in interface org.reactivestreams.Publisher<T>
public final void onDataAvailable()
public void onAllDataRead()
public final void onError(Throwable t)
protected abstract void checkOnDataAvailable()
protected abstract T read() throws IOException
null
IOException