Top Description Fields Constructors Methods
org.apache.hc.core5.http.nio.support

public Class BasicPushProducer

extends Object
implements AsyncPushProducer
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.nio.AsyncPushProducer, org.apache.hc.core5.http.nio.AsyncDataProducer, org.apache.hc.core5.http.nio.ResourceHolder
Imports
java.io.IOException, org.apache.hc.core5.http.HttpException, .HttpResponse, .HttpStatus, org.apache.hc.core5.http.message.BasicHttpResponse, org.apache.hc.core5.http.nio.AsyncEntityProducer, .AsyncPushProducer, .DataStreamChannel, .ResponseChannel, org.apache.hc.core5.http.protocol.HttpContext, org.apache.hc.core5.util.Args

Basic implementation of AsyncPushProducer that produces one fixed response and relies on a AsyncEntityProducer to generate response entity stream.
Since
5.0

Field Summary

Modifier and TypeField and Description
private final AsyncEntityProducer
private final HttpResponse

Constructor Summary

AccessConstructor and Description
public
BasicPushProducer(final HttpResponse response, final AsyncEntityProducer dataProducer)

public
BasicPushProducer(final int code, final AsyncEntityProducer dataProducer)

public

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.available.

Returns the number of bytes immediately available for output.
public void
failed(final Exception
the cause of the failure.
cause
)

Implements org.apache.hc.core5.http.nio.AsyncPushProducer.failed.

Triggered to signal a failure in data generation.
public void
produce(final DataStreamChannel
the data channel capable to accepting more data.
channel
)

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.produce.

Triggered to signal the ability of the underlying data channel to accept more data.
public void
produceResponse(final ResponseChannel
the response channel capable to accepting response messages.
channel
,
final HttpContext
the actual execution context.
httpContext
)

Implements org.apache.hc.core5.http.nio.AsyncPushProducer.produceResponse.

Triggered to signal the ability of the underlying response channel to accept response messages.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataProducerback to summary
private final AsyncEntityProducer dataProducer
responseback to summary
private final HttpResponse response

Constructor Detail

BasicPushProducerback to summary
public BasicPushProducer(final HttpResponse response, final AsyncEntityProducer dataProducer)
BasicPushProducerback to summary
public BasicPushProducer(final int code, final AsyncEntityProducer dataProducer)
BasicPushProducerback to summary
public BasicPushProducer(final AsyncEntityProducer dataProducer)

Method Detail

availableback to summary
public int available()

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.available.

Doc from org.apache.hc.core5.http.nio.AsyncDataProducer.available.

Returns the number of bytes immediately available for output. This method can be used as a hint to control output events of the underlying I/O session.

Returns:int

the number of bytes immediately available for output

Annotations
@Override
failedback to summary
public void failed(final Exception cause)

Implements org.apache.hc.core5.http.nio.AsyncPushProducer.failed.

Doc from org.apache.hc.core5.http.nio.AsyncPushProducer.failed.

Triggered to signal a failure in data generation.

Parameters
cause:Exception

the cause of the failure.

Annotations
@Override
produceback to summary
public void produce(final DataStreamChannel channel) throws IOException

Implements org.apache.hc.core5.http.nio.AsyncDataProducer.produce.

Doc from org.apache.hc.core5.http.nio.AsyncDataProducer.produce.

Triggered to signal the ability of the underlying data channel to accept more data. The data producer can choose to write data immediately inside the call or asynchronously at some later point.

Parameters
channel:DataStreamChannel

the data channel capable to accepting more data.

Annotations
@Override
produceResponseback to summary
public void produceResponse(final ResponseChannel channel, final HttpContext httpContext) throws HttpException, IOException

Implements org.apache.hc.core5.http.nio.AsyncPushProducer.produceResponse.

Doc from org.apache.hc.core5.http.nio.AsyncPushProducer.produceResponse.

Triggered to signal the ability of the underlying response channel to accept response messages. The data producer can choose to send a final response message immediately inside the call or asynchronously at some later point. The final response can be preceded by a number of intermediate messages.

Parameters
channel:ResponseChannel

the response channel capable to accepting response messages.

httpContext:HttpContext

the actual execution context.

Annotations
@Override
releaseResourcesback to summary
public void releaseResources()

Implements org.apache.hc.core5.http.nio.ResourceHolder.releaseResources.

Annotations
@Override