@Override public final void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.getAndSet(null); if (dataConsumer != null) { dataConsumer.streamEnd(trailers); } }
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 final void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.getAndSet(null); if (dataConsumer != null) { dataConsumer.streamEnd(trailers); } }
@Override public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.get(); if (dataConsumer != null) { dataConsumer.streamEnd(trailers); } }
@Override public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer dataConsumer = dataConsumerRef.get(); if (dataConsumer != null) { dataConsumer.streamEnd(trailers); } }
@Override public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer entityConsumer = entityConsumerRef.getAndSet(null); if (entityConsumer != null) { entityConsumer.streamEnd(trailers); } else { execRuntime.validateConnection(); } if (messageCountDown.decrementAndGet() <= 0) { asyncExecCallback.completed(); } }
@Override public void streamEnd(final List<? extends Header> trailers) throws HttpException, IOException { final AsyncDataConsumer entityConsumer = entityConsumerRef.getAndSet(null); if (entityConsumer != null) { entityConsumer.streamEnd(trailers); } else { execRuntime.validateConnection(); } asyncExecCallback.completed(); }
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); } }