|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ning.http.client.providers.grizzly.FeedableBodyGenerator
public class FeedableBodyGenerator
A Grizzly-specific BodyGenerator
that allows data to be fed to the
connection in blocking or non-blocking fashion via the use of a FeedableBodyGenerator.Feeder
.
This class provides two FeedableBodyGenerator.Feeder
implementations for rapid prototyping.
First is the FeedableBodyGenerator.SimpleFeeder
which is simply a listener that asynchronous
data transferring has been initiated. The second is the FeedableBodyGenerator.NonBlockingFeeder
which allows reading and feeding data in a non-blocking fashion.
Nested Class Summary | |
---|---|
static class |
FeedableBodyGenerator.BaseFeeder
Base class for FeedableBodyGenerator.Feeder implementations. |
static interface |
FeedableBodyGenerator.Feeder
Specifies the functionality all Feeders must implement. |
static class |
FeedableBodyGenerator.NonBlockingFeeder
Implementations of this class provide the framework to read data from some source and feed data to the FeedableBodyGenerator
without blocking. |
static class |
FeedableBodyGenerator.SimpleFeeder
This simple FeedableBodyGenerator.Feeder implementation allows the implementation to
feed data in whatever fashion is deemed appropriate. |
Field Summary | |
---|---|
static int |
DEFAULT
Defer to whatever the connection has been configured for max pending bytes. |
static int |
UNBOUND
There is no limit on bytes waiting to be written. |
Constructor Summary | |
---|---|
FeedableBodyGenerator()
|
Method Summary | |
---|---|
Body |
createBody()
Creates a new instance of the request body to be read. |
void |
setFeeder(FeedableBodyGenerator.Feeder feeder)
Add a FeedableBodyGenerator.Feeder implementation that will be invoked when writing
without blocking is possible. |
void |
setMaxPendingBytes(int maxPendingBytes)
Configured the maximum number of bytes that may be pending to be written to the wire. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int UNBOUND
public static final int DEFAULT
Constructor Detail |
---|
public FeedableBodyGenerator()
Method Detail |
---|
public Body createBody() throws IOException
createBody
in interface BodyGenerator
null
.
IOException
- If the body could not be created.public void setMaxPendingBytes(int maxPendingBytes)
maxPendingBytes
- maximum number of bytes that may be queued to
be written to the wire.
IllegalStateException
- if called after initializeAsynchronousTransfer(FilterChainContext, HttpRequestPacket)
has been called by the GrizzlyAsyncHttpProvider
.
IllegalArgumentException
- if maxPendingBytes is less than zero and is
not UNBOUND
or DEFAULT
.public void setFeeder(FeedableBodyGenerator.Feeder feeder)
FeedableBodyGenerator.Feeder
implementation that will be invoked when writing
without blocking is possible. This method must be set before dispatching
the request this feeder is associated with.
feeder
- the FeedableBodyGenerator.Feeder
responsible for providing data.
IllegalStateException
- if called after initializeAsynchronousTransfer(FilterChainContext, HttpRequestPacket)
has been called by the GrizzlyAsyncHttpProvider
.
IllegalArgumentException
- if feeder
is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |