ErrorResponseProducer( final HttpResponse response, final HttpEntity entity, final boolean keepAlive) { super(); this.response = response; this.entity = entity; if (entity instanceof HttpAsyncContentProducer) { this.contentProducer = (HttpAsyncContentProducer) entity; } else { this.contentProducer = new EntityAsyncContentProducer(entity); } this.keepAlive = keepAlive; }
ErrorResponseProducer( final HttpResponse response, final HttpEntity entity, final boolean keepAlive) { super(); this.response = response; this.entity = entity; if (entity instanceof HttpAsyncContentProducer) { this.contentProducer = (HttpAsyncContentProducer) entity; } else { this.contentProducer = new EntityAsyncContentProducer(entity); } this.keepAlive = keepAlive; }
/** * 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; } }
/** * 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; } }
/** * Creates a producer that can be used to transmit the given request * message. If the request message encloses an {@link HttpEntity} * it is also expected to implement {@link HttpAsyncContentProducer}. * * @param target target host. * @param request request message. */ public BasicAsyncRequestProducer(final HttpHost target, final HttpRequest request) { Args.notNull(target, "HTTP host"); Args.notNull(request, "HTTP request"); this.target = target; this.request = request; if (request instanceof HttpEntityEnclosingRequest) { final HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); if (entity != null) { if (entity instanceof HttpAsyncContentProducer) { this.producer = (HttpAsyncContentProducer) entity; } else { this.producer = new EntityAsyncContentProducer(entity); } } else { this.producer = null; } } else { this.producer = null; } }
/** * Creates a producer that can be used to transmit the given request * message. If the request message encloses an {@link HttpEntity} * it is also expected to implement {@link HttpAsyncContentProducer}. * * @param target target host. * @param request request message. */ public BasicAsyncRequestProducer(final HttpHost target, final HttpRequest request) { Args.notNull(target, "HTTP host"); Args.notNull(request, "HTTP request"); this.target = target; this.request = request; if (request instanceof HttpEntityEnclosingRequest) { final HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity(); if (entity != null) { if (entity instanceof HttpAsyncContentProducer) { this.producer = (HttpAsyncContentProducer) entity; } else { this.producer = new EntityAsyncContentProducer(entity); } } else { this.producer = null; } } else { this.producer = null; } }