public class HTTPResponseProcessor
extends java.lang.Object
HTTPResponse
object.Modifier and Type | Class | Description |
---|---|---|
static interface |
HTTPResponseProcessor.HTTPResponseCallback |
Used for processing data with
HTTPResponseProcessor . |
Modifier and Type | Field | Description |
---|---|---|
static int |
MAX_HEADER_SIZE |
|
static int |
MAX_RESPONSE_HEADER_SIZE |
Constructor | Description |
---|---|
HTTPResponseProcessor(boolean headRequest) |
Creates a new
HTTPResponseProcessor . |
Modifier and Type | Method | Description |
---|---|---|
void |
addHTTPResponseCallback(HTTPResponseProcessor.HTTPResponseCallback hrc) |
Adds an
HTTPResponseProcessor.HTTPResponseCallback to this processor that will be called back as
a data stream is processed. |
void |
clearBuffer() |
Resets the processor and any pending buffers left in it.
|
void |
connectionClosed() |
Called when an http response connection is closes.
|
java.util.Collection<HTTPResponseProcessor.HTTPResponseCallback> |
getAllCallbacks() |
Gets all listeners that are on this processor.
|
int |
getBufferSize() |
returns the total amount of unprocessable data pending.
|
int |
getCurrentBodySize() |
Gets the current body size for the httpResponse currently in process.
|
boolean |
isProcessing() |
Lets you know if a response is currently being processed or not.
|
boolean |
isResponseComplete() |
Lets you know if we have gotten enough data to see a full response yet.
|
void |
processData(byte[] ba) |
byte[] to send through the processor.
|
void |
processData(java.nio.ByteBuffer bb) |
ByteBuffer to send through the processor. |
void |
processData(org.threadly.litesockets.buffers.MergedByteBuffers bb) |
MergedByteBuffers to send through the processor. |
void |
removeHTTPResponseCallback(HTTPResponseProcessor.HTTPResponseCallback hrc) |
Removes an
HTTPResponseProcessor.HTTPResponseCallback from this processor the removed callback
will no longer be called. |
void |
reset() |
Forces a reset on the HTTPProcessor.
|
void |
reset(java.lang.Throwable t) |
Forces a reset on the HTTPProcessor with an error, call callbacks will be called with hasError if a request has started.
|
public static final int MAX_RESPONSE_HEADER_SIZE
public static final int MAX_HEADER_SIZE
public HTTPResponseProcessor(boolean headRequest)
HTTPResponseProcessor
.public void addHTTPResponseCallback(HTTPResponseProcessor.HTTPResponseCallback hrc)
HTTPResponseProcessor.HTTPResponseCallback
to this processor that will be called back as
a data stream is processed.hrc
- the callback to addpublic void removeHTTPResponseCallback(HTTPResponseProcessor.HTTPResponseCallback hrc)
HTTPResponseProcessor.HTTPResponseCallback
from this processor the removed callback
will no longer be called.hrc
- the callback to remove.public java.util.Collection<HTTPResponseProcessor.HTTPResponseCallback> getAllCallbacks()
HTTPResponseProcessor.HTTPResponseCallback
objects currently listening for data.public void processData(byte[] ba)
ba
- to send through the processor.public void processData(java.nio.ByteBuffer bb)
ByteBuffer
to send through the processor.bb
- ByteBuffer
to send through the processor.public void processData(org.threadly.litesockets.buffers.MergedByteBuffers bb)
MergedByteBuffers
to send through the processor.bb
- MergedByteBuffers
to send through the processor.public void connectionClosed()
public void clearBuffer()
public void reset()
clearBuffer()
public void reset(java.lang.Throwable t)
t
- exception to pass to the callbacks.
NOTE: any currently unprocessed buffer will remain! see clearBuffer()
public boolean isResponseComplete()
public int getBufferSize()
public int getCurrentBodySize()
public boolean isProcessing()