Class JsonResponseProducers
java.lang.Object
org.apache.hc.core5.jackson2.http.JsonResponseProducers
Factory class for JSON
AsyncResponseProducers.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AsyncResponseProducercreate(HttpResponse response, com.fasterxml.jackson.core.JsonFactory jsonFactory, JsonConsumer<com.fasterxml.jackson.core.JsonGenerator> consumer) CreatesAsyncResponseProducerthat generates an HTTP response enclosing JSON content generated using the providedJsonGenerator.static AsyncResponseProducercreate(HttpResponse response, com.fasterxml.jackson.databind.JsonNode jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a serialized JSON object as a message body.static <T> AsyncResponseProducercreate(HttpResponse response, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ObjectProducer<T> objectProducer) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a sequence of serialized JSON object as a message body.static <T> AsyncResponseProducercreate(HttpResponse response, T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a serialized JSON object as a message body.
-
Constructor Details
-
JsonResponseProducers
public JsonResponseProducers()
-
-
Method Details
-
create
public static <T> AsyncResponseProducer create(HttpResponse response, T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a serialized JSON object as a message body.- Type Parameters:
T- the type of objects used by the producer.- Parameters:
response- the response message head.jsonObject- teh JSON object to be enclosed as a message body.objectMapper- the object mapper to be used to serialize JSON content.- Returns:
- the response producer.
-
create
public static AsyncResponseProducer create(HttpResponse response, com.fasterxml.jackson.databind.JsonNode jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a serialized JSON object as a message body.- Parameters:
response- the response message head.jsonObject- the JSON object to be enclosed as a message body.objectMapper- the object mapper to be used to serialize JSON content.- Returns:
- the response producer.
-
create
public static <T> AsyncResponseProducer create(HttpResponse response, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ObjectProducer<T> objectProducer) CreatesAsyncResponseProducerthat generates an HTTP response enclosing a sequence of serialized JSON object as a message body.- Parameters:
response- the response message head.objectMapper- the object mapper to be used to serialize JSON content.objectProducer- the JSON object producer.- Returns:
- the response producer.
-
create
public static AsyncResponseProducer create(HttpResponse response, com.fasterxml.jackson.core.JsonFactory jsonFactory, JsonConsumer<com.fasterxml.jackson.core.JsonGenerator> consumer) CreatesAsyncResponseProducerthat generates an HTTP response enclosing JSON content generated using the providedJsonGenerator.- Parameters:
response- the response message head.jsonFactory- JSON factory.consumer- the recipient of JSON content generator.- Returns:
- the response producer.
-