public class FrameFileHttpResponseHandler extends Object implements HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>
HttpResponseHandler that streams data into a ReadableByteChunksFrameChannel.
It is not required that the request actually fetches an entire frame file. The return object for this handler,
FrameFilePartialFetch, allows callers to tell how much of the file was read in a particular request.
This handler implements backpressure through FrameFilePartialFetch.backpressureFuture(). This allows callers
to back off from issuing the next request, if appropriate. However: the handler does not implement backpressure
through the HttpResponseHandler.TrafficCop mechanism. Therefore, it is important that each request retrieve
a modest amount of data.
The last fetch must be empty (zero content bytes) and must have the header HEADER_LAST_FETCH_NAME set to
HEADER_LAST_FETCH_VALUE. Under these conditions, FrameFilePartialFetch.isLastFetch() returns true.HttpResponseHandler.TrafficCop| Modifier and Type | Field and Description |
|---|---|
static String |
HEADER_LAST_FETCH_NAME |
static String |
HEADER_LAST_FETCH_VALUE |
| Constructor and Description |
|---|
FrameFileHttpResponseHandler(ReadableByteChunksFrameChannel channel) |
| Modifier and Type | Method and Description |
|---|---|
ClientResponse<FrameFilePartialFetch> |
done(ClientResponse<FrameFilePartialFetch> clientResponse)
Called after the final handleResponse() or handleChunk() call, signifying that no more data
will arrive.
|
void |
exceptionCaught(ClientResponse<FrameFilePartialFetch> clientResponse,
Throwable e) |
ClientResponse<FrameFilePartialFetch> |
handleChunk(ClientResponse<FrameFilePartialFetch> clientResponse,
org.jboss.netty.handler.codec.http.HttpChunk chunk,
long chunkNum)
Called for chunked responses, indicating another HttpChunk has arrived.
|
ClientResponse<FrameFilePartialFetch> |
handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response,
HttpResponseHandler.TrafficCop trafficCop)
Handles the initial HttpResponse object that comes back from Netty.
|
public static final String HEADER_LAST_FETCH_NAME
public static final String HEADER_LAST_FETCH_VALUE
public FrameFileHttpResponseHandler(ReadableByteChunksFrameChannel channel)
public ClientResponse<FrameFilePartialFetch> handleResponse(org.jboss.netty.handler.codec.http.HttpResponse response, HttpResponseHandler.TrafficCop trafficCop)
HttpResponseHandlerhandleResponse in interface HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>response - response from NettytrafficCop - flow controller, allows resuming suspended readspublic ClientResponse<FrameFilePartialFetch> handleChunk(ClientResponse<FrameFilePartialFetch> clientResponse, org.jboss.netty.handler.codec.http.HttpChunk chunk, long chunkNum)
HttpResponseHandlerhandleChunk in interface HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>clientResponse - last response returned by the prior handleResponse() or handleChunk()chunk - the new chunk of datachunkNum - the sequence number of this chunk (increases monotonically)public ClientResponse<FrameFilePartialFetch> done(ClientResponse<FrameFilePartialFetch> clientResponse)
HttpResponseHandlerdone in interface HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>clientResponse - last response returned by handleResponse() or handleChunk()public void exceptionCaught(ClientResponse<FrameFilePartialFetch> clientResponse, Throwable e)
exceptionCaught in interface HttpResponseHandler<FrameFilePartialFetch,FrameFilePartialFetch>Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.