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

public Class BasicRequestProducer

extends Object
implements AsyncRequestProducer
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.nio.AsyncRequestProducer, org.apache.hc.core5.http.nio.AsyncDataProducer, org.apache.hc.core5.http.nio.ResourceHolder
Imports
java.io.IOException, java.net.URI, org.apache.hc.core5.http.HttpException, .HttpHost, .HttpRequest, .Method, org.apache.hc.core5.http.message.BasicHttpRequest, org.apache.hc.core5.http.nio.AsyncEntityProducer, .AsyncRequestProducer, .DataStreamChannel, .RequestChannel, org.apache.hc.core5.http.protocol.HttpContext

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

Field Summary

Modifier and TypeField and Description
private final AsyncEntityProducer
private final HttpRequest

Constructor Summary

AccessConstructor and Description
public
BasicRequestProducer(final HttpRequest request, final AsyncEntityProducer dataProducer)

public
BasicRequestProducer(final String method, final HttpHost host, final String path, final AsyncEntityProducer dataProducer)

public
BasicRequestProducer(final String method, final HttpHost host, final String path)

public
BasicRequestProducer(final String method, final URI requestUri, final AsyncEntityProducer dataProducer)

public
BasicRequestProducer(final String method, final URI requestUri)

public
BasicRequestProducer(final Method method, final HttpHost host, final String path, final AsyncEntityProducer dataProducer)

public
BasicRequestProducer(final Method method, final HttpHost host, final String path)

public
BasicRequestProducer(final Method method, final URI requestUri, final AsyncEntityProducer dataProducer)

public
BasicRequestProducer(final Method method, final URI requestUri)

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.AsyncRequestProducer.failed.

Triggered to signal a failure in data generation.
public boolean
isRepeatable()

Implements org.apache.hc.core5.http.nio.AsyncRequestProducer.isRepeatable.

Determines whether the producer can consistently produce the same content after invocation of ResourceHolder#releaseResources().
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
public void
sendRequest(final RequestChannel
the request channel capable to accepting a request message.
requestChannel
,
final HttpContext
the actual execution context.
httpContext
)

Implements org.apache.hc.core5.http.nio.AsyncRequestProducer.sendRequest.

Triggered to signal the ability of the underlying request channel to accept a request messages.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dataProducerback to summary
private final AsyncEntityProducer dataProducer
requestback to summary
private final HttpRequest request

Constructor Detail

BasicRequestProducerback to summary
public BasicRequestProducer(final HttpRequest request, final AsyncEntityProducer dataProducer)
BasicRequestProducerback to summary
public BasicRequestProducer(final String method, final HttpHost host, final String path, final AsyncEntityProducer dataProducer)
BasicRequestProducerback to summary
public BasicRequestProducer(final String method, final HttpHost host, final String path)
BasicRequestProducerback to summary
public BasicRequestProducer(final String method, final URI requestUri, final AsyncEntityProducer dataProducer)
BasicRequestProducerback to summary
public BasicRequestProducer(final String method, final URI requestUri)
BasicRequestProducerback to summary
public BasicRequestProducer(final Method method, final HttpHost host, final String path, final AsyncEntityProducer dataProducer)
BasicRequestProducerback to summary
public BasicRequestProducer(final Method method, final HttpHost host, final String path)
BasicRequestProducerback to summary
public BasicRequestProducer(final Method method, final URI requestUri, final AsyncEntityProducer dataProducer)
BasicRequestProducerback to summary
public BasicRequestProducer(final Method method, final URI requestUri)

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.AsyncRequestProducer.failed.

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

Triggered to signal a failure in data generation.

Parameters
cause:Exception

the cause of the failure.

Annotations
@Override
isRepeatableback to summary
public boolean isRepeatable()

Implements org.apache.hc.core5.http.nio.AsyncRequestProducer.isRepeatable.

Doc from org.apache.hc.core5.http.nio.AsyncRequestProducer.isRepeatable.

Determines whether the producer can consistently produce the same content after invocation of ResourceHolder#releaseResources().

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
releaseResourcesback to summary
public void releaseResources()

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

Annotations
@Override
sendRequestback to summary
public void sendRequest(final RequestChannel requestChannel, final HttpContext httpContext) throws HttpException, IOException

Implements org.apache.hc.core5.http.nio.AsyncRequestProducer.sendRequest.

Doc from org.apache.hc.core5.http.nio.AsyncRequestProducer.sendRequest.

Triggered to signal the ability of the underlying request channel to accept a request messages. The data producer can choose to send a request message immediately inside the call or asynchronously at some later point.

Parameters
requestChannel:RequestChannel

the request channel capable to accepting a request message.

httpContext:HttpContext

the actual execution context.

Annotations
@Override