Top Description Inners Methods
org.apache.hc.core5.http.nio

public Interface AsyncServerRequestHandler<T>

Annotations
@Contract
threading:STATELESS
Type Parameters
<T>
request representation.
Imports
java.io.IOException, org.apache.hc.core5.annotation.Contract, .ThreadingBehavior, org.apache.hc.core5.http.EntityDetails, .HttpException, .HttpRequest, .HttpResponse, org.apache.hc.core5.http.protocol.HttpContext

AsyncServerRequestHandler represents a routine for processing of a specific group of HTTP requests. Request execution filters are designed to take care of protocol specific aspects, whereas individual request handlers are expected to take care of application specific HTTP processing. The main purpose of a request handler is to generate a response object with a content entity to be sent back to the client in response to the given request.
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
AsyncServerRequestHandler.ResponseTrigger

Response trigger that can be used to submit a final HTTP response and terminate HTTP request processing.

Method Summary

Modifier and TypeMethod and Description
public void
handle(T
the request object.
requestObject
,
AsyncServerRequestHandler.ResponseTrigger
the response trigger.
responseTrigger
,
HttpContext
the actual execution context.
context
)

Triggered to handles the request object produced by the AsyncRequestConsumer returned from the prepare(HttpRequest, EntityDetails, HttpContext) method.

public AsyncRequestConsumer<T>

Returns:

the request handler.
prepare
(HttpRequest
the incoming request head.
request
,
EntityDetails
the request entity details or null if the request does not enclose an entity.
entityDetails
,
HttpContext
the actual execution context.
context
)

Triggered to signal new incoming request.

Method Detail

handleback to summary
public void handle(T requestObject, AsyncServerRequestHandler.ResponseTrigger responseTrigger, HttpContext context) throws HttpException, IOException

Triggered to handles the request object produced by the AsyncRequestConsumer returned from the prepare(HttpRequest, EntityDetails, HttpContext) method. The handler can choose to send response messages immediately inside the call or asynchronously at some later point.

Parameters
requestObject:T

the request object.

responseTrigger:AsyncServerRequestHandler.ResponseTrigger

the response trigger.

context:HttpContext

the actual execution context.

prepareback to summary
public AsyncRequestConsumer<T> prepare(HttpRequest request, EntityDetails entityDetails, HttpContext context) throws HttpException

Triggered to signal new incoming request. The handler can create a AsyncRequestConsumer based on properties of the request head and entity details and let it process the request data stream. The request handler will be used to generate an object that represents request data.

Parameters
request:HttpRequest

the incoming request head.

entityDetails:EntityDetails

the request entity details or null if the request does not enclose an entity.

context:HttpContext

the actual execution context.

Returns:AsyncRequestConsumer<T>

the request handler.

org.apache.hc.core5.http.nio back to summary

public Interface AsyncServerRequestHandler.ResponseTrigger


Response trigger that can be used to submit a final HTTP response and terminate HTTP request processing.

Method Summary

Modifier and TypeMethod and Description
public void
pushPromise(HttpRequest
the request message header used as a promise.
promise
,
HttpContext
the actual execution context.
context
,
AsyncPushProducer
the push response message producer.
responseProducer
)

Pushes a request message head as a promise to deliver a response message.

public void
sendInformation(HttpResponse
the intermediate (1xx) HTTP response
response
,
HttpContext
the actual execution context.
context
)

Sends an intermediate informational HTTP response to the client.

public void
submitResponse(AsyncResponseProducer
the HTTP response message producer.
responseProducer
,
HttpContext
the actual execution context.
context
)

Sends a final HTTP response to the client.

Method Detail

pushPromiseback to summary
public void pushPromise(HttpRequest promise, HttpContext context, AsyncPushProducer responseProducer) throws HttpException, IOException

Pushes a request message head as a promise to deliver a response message.

Parameters
promise:HttpRequest

the request message header used as a promise.

context:HttpContext

the actual execution context.

responseProducer:AsyncPushProducer

the push response message producer.

sendInformationback to summary
public void sendInformation(HttpResponse response, HttpContext context) throws HttpException, IOException

Sends an intermediate informational HTTP response to the client.

Parameters
response:HttpResponse

the intermediate (1xx) HTTP response

context:HttpContext

the actual execution context.

submitResponseback to summary
public void submitResponse(AsyncResponseProducer responseProducer, HttpContext context) throws HttpException, IOException

Sends a final HTTP response to the client.

Parameters
responseProducer:AsyncResponseProducer

the HTTP response message producer.

context:HttpContext

the actual execution context.