public abstract class QueuedHttpInput<T> extends HttpInput<T>
QueuedHttpInput
provides an implementation of ServletInputStream
for HttpChannel
.
QueuedHttpInput
holds a queue of items passed to it by calls to content(Object)
.
QueuedHttpInput
stores the items directly; if the items contain byte buffers, it does not copy them
but simply holds references to the item, thus the caller must organize for those buffers to valid while
held by this class.
To assist the caller, subclasses may override methods HttpInput.onAsyncRead()
,
onContentConsumed(Object)
and onAllContentConsumed()
that can be implemented so that the
caller will know when buffers are queued and consumed.
HttpInput.State
Constructor and Description |
---|
QueuedHttpInput() |
Modifier and Type | Method and Description |
---|---|
protected void |
blockForContent() |
void |
content(T item)
Add some content to the input stream
|
void |
earlyEOF()
This method should be called to signal to the HttpInput
that an EOF has arrived before all the expected content.
|
void |
messageComplete() |
protected T |
nextContent()
Access the next content to be consumed from.
|
protected void |
onAllContentConsumed()
Called by this HttpInput to signal all available content has been consumed
|
protected abstract void |
onContentConsumed(T item) |
void |
recycle() |
available, consume, consumeAll, failed, get, getContentRead, getNextContent, init, isFinished, isReady, lock, onAsyncRead, read, read, remaining, run, setReadListener, unready
readLine
close, mark, markSupported, read, reset, skip
protected T nextContent()
HttpInput
HttpInput.get(Object, byte[], int, int)
or HttpInput.consume(Object, int)
are required to consume data from the content.nextContent
in class HttpInput<T>
protected abstract void onContentConsumed(T item)
protected void blockForContent() throws IOException
blockForContent
in class HttpInput<T>
IOException
protected void onAllContentConsumed()
public void content(T item)
public void earlyEOF()
HttpInput
public void messageComplete()
messageComplete
in class HttpInput<T>
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.