private void triggerResponse( final SimpleHttpResponse cacheResponse, final AsyncExecChain.Scope scope, final AsyncExecCallback asyncExecCallback) { scope.clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, cacheResponse); scope.execRuntime.releaseEndpoint(); final SimpleBody body = cacheResponse.getBody(); final byte[] content = body != null ? body.getBodyBytes() : null; final ContentType contentType = body != null ? body.getContentType() : null; try { final AsyncDataConsumer dataConsumer = asyncExecCallback.handleResponse( cacheResponse, content != null ? new BasicEntityDetails(content.length, contentType) : null); if (dataConsumer != null) { dataConsumer.consume(ByteBuffer.wrap(content)); dataConsumer.streamEnd(null); } asyncExecCallback.completed(); } catch (final HttpException | IOException ex) { asyncExecCallback.failed(ex); } }
@Override public void consume(final ByteBuffer src) throws IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.get(); if (dataConsumer != null) { dataConsumer.consume(src); } }
@Override public void consume(final ByteBuffer src) throws IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.get(); if (dataConsumer != null) { dataConsumer.consume(src); } }
@Override public void consume(final ByteBuffer src) throws IOException { final AsyncDataConsumer entityConsumer = entityConsumerRef.get(); if (entityConsumer != null) { entityConsumer.consume(src); } }
@Override public void consume(final ByteBuffer src) throws IOException { final AsyncDataConsumer entityConsumer = entityConsumerRef.get(); if (entityConsumer != null) { entityConsumer.consume(src); } }
private void triggerResponse( final SimpleHttpResponse cacheResponse, final AsyncExecChain.Scope scope, final AsyncExecCallback asyncExecCallback) { scope.clientContext.setAttribute(HttpCoreContext.HTTP_RESPONSE, cacheResponse); scope.execRuntime.releaseEndpoint(); final SimpleBody body = cacheResponse.getBody(); final byte[] content = body != null ? body.getBodyBytes() : null; final ContentType contentType = body != null ? body.getContentType() : null; try { final AsyncDataConsumer dataConsumer = asyncExecCallback.handleResponse( cacheResponse, content != null ? new BasicEntityDetails(content.length, contentType) : null); if (dataConsumer != null) { dataConsumer.consume(ByteBuffer.wrap(content)); dataConsumer.streamEnd(null); } asyncExecCallback.completed(); } catch (final HttpException | IOException ex) { asyncExecCallback.failed(ex); } }