Package org.apache.http.nio.protocol
Class ErrorResponseProducer
- java.lang.Object
-
- org.apache.http.nio.protocol.ErrorResponseProducer
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,HttpAsyncResponseProducer
public class ErrorResponseProducer extends java.lang.Object implements HttpAsyncResponseProducer
This class changed from package private to public in version 4.4.8.- Since:
- 4.4.8
-
-
Constructor Summary
Constructors Constructor Description ErrorResponseProducer(HttpResponse response, HttpEntity entity, boolean keepAlive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidfailed(java.lang.Exception ex)Invoked to signal that the response processing terminated abnormally.HttpResponsegenerateResponse()Invoked to generate a HTTP response message head.voidproduceContent(ContentEncoder encoder, IOControl ioctrl)Invoked to write out a chunk of content to theContentEncoder.voidresponseCompleted(HttpContext context)Invoked to signal that the response has been fully written out.
-
-
-
Constructor Detail
-
ErrorResponseProducer
public ErrorResponseProducer(HttpResponse response, HttpEntity entity, boolean keepAlive)
-
-
Method Detail
-
generateResponse
public HttpResponse generateResponse()
Description copied from interface:HttpAsyncResponseProducerInvoked to generate a HTTP response message head.- Specified by:
generateResponsein interfaceHttpAsyncResponseProducer- Returns:
- HTTP response message.
-
produceContent
public void produceContent(ContentEncoder encoder, IOControl ioctrl) throws java.io.IOException
Description copied from interface:HttpAsyncResponseProducerInvoked to write out a chunk of content to theContentEncoder. TheIOControlinterface 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
ContentEncoderobject is not thread-safe and should only be used within the context of this method call. TheIOControlobject can be shared and used on other thread to resume output event notifications when more content is made available.- Specified by:
produceContentin interfaceHttpAsyncResponseProducer- Parameters:
encoder- content encoder.ioctrl- I/O control of the underlying connection.- Throws:
java.io.IOException- in case of an I/O error
-
responseCompleted
public void responseCompleted(HttpContext context)
Description copied from interface:HttpAsyncResponseProducerInvoked to signal that the response has been fully written out.- Specified by:
responseCompletedin interfaceHttpAsyncResponseProducer- Parameters:
context- HTTP context
-
failed
public void failed(java.lang.Exception ex)
Description copied from interface:HttpAsyncResponseProducerInvoked to signal that the response processing terminated abnormally.- Specified by:
failedin interfaceHttpAsyncResponseProducer- Parameters:
ex- exception
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-