org.apache.http.nio.protocol
Class ErrorResponseProducer

java.lang.Object
  extended by org.apache.http.nio.protocol.ErrorResponseProducer
All Implemented Interfaces:
Closeable, HttpAsyncResponseProducer

public class ErrorResponseProducer
extends Object
implements HttpAsyncResponseProducer

This class changed from package private to public in version 4.4.8.

Since:
4.4.8

Constructor Summary
ErrorResponseProducer(HttpResponse response, HttpEntity entity, boolean keepAlive)
           
 
Method Summary
 void close()
           
 void failed(Exception ex)
          Invoked to signal that the response processing terminated abnormally.
 HttpResponse generateResponse()
          Invoked to generate a HTTP response message head.
 void produceContent(ContentEncoder encoder, IOControl ioctrl)
          Invoked to write out a chunk of content to the ContentEncoder.
 void responseCompleted(HttpContext context)
          Invoked to signal that the response has been fully written out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorResponseProducer

public ErrorResponseProducer(HttpResponse response,
                             HttpEntity entity,
                             boolean keepAlive)
Method Detail

generateResponse

public HttpResponse generateResponse()
Description copied from interface: HttpAsyncResponseProducer
Invoked to generate a HTTP response message head.

Specified by:
generateResponse in interface HttpAsyncResponseProducer
Returns:
HTTP response message.

produceContent

public void produceContent(ContentEncoder encoder,
                           IOControl ioctrl)
                    throws IOException
Description copied from interface: HttpAsyncResponseProducer
Invoked to write out a chunk of content to the ContentEncoder. The IOControl interface can be used to suspend output event notifications if the producer is temporarily unable to produce more content.

When all content is finished, the producer MUST call ContentEncoder.complete(). Failure to do so may cause the entity to be incorrectly delimited.

Please note that the ContentEncoder object is not thread-safe and should only be used within the context of this method call. The IOControl object can be shared and used on other thread to resume output event notifications when more content is made available.

Specified by:
produceContent in interface HttpAsyncResponseProducer
Parameters:
encoder - content encoder.
ioctrl - I/O control of the underlying connection.
Throws:
IOException - in case of an I/O error

responseCompleted

public void responseCompleted(HttpContext context)
Description copied from interface: HttpAsyncResponseProducer
Invoked to signal that the response has been fully written out.

Specified by:
responseCompleted in interface HttpAsyncResponseProducer
Parameters:
context - HTTP context

failed

public void failed(Exception ex)
Description copied from interface: HttpAsyncResponseProducer
Invoked to signal that the response processing terminated abnormally.

Specified by:
failed in interface HttpAsyncResponseProducer
Parameters:
ex - exception

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2005–2018 The Apache Software Foundation. All rights reserved.