/** * Creates a producer that can be used to transmit the given response message. If the response * message encloses an {@link HttpEntity} it is also expected to implement {@link * HttpAsyncContentProducer}. * * @param response response message. */ public BasicAsyncResponseProducer(final HttpResponse response) { super(); Args.notNull(response, "HTTP response"); this.response = response; final HttpEntity entity = response.getEntity(); if (entity != null) { if (entity instanceof HttpAsyncContentProducer) { this.producer = (HttpAsyncContentProducer) entity; } else { this.producer = new EntityAsyncContentProducer(entity); } } else { this.producer = null; } }
@Override public HttpEntity getEntity() { return original.getEntity(); }