Class JsonResponseProducers

java.lang.Object
org.apache.hc.core5.jackson2.http.JsonResponseProducers

public final class JsonResponseProducers extends Object
Factory class for JSON AsyncResponseProducers.
  • Constructor Details

    • JsonResponseProducers

      public JsonResponseProducers()
  • Method Details

    • create

      public static <T> AsyncResponseProducer create(HttpResponse response, T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Creates AsyncResponseProducer that 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)
      Creates AsyncResponseProducer that 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)
      Creates AsyncResponseProducer that 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)
      Creates AsyncResponseProducer that generates an HTTP response enclosing JSON content generated using the provided JsonGenerator.
      Parameters:
      response - the response message head.
      jsonFactory - JSON factory.
      consumer - the recipient of JSON content generator.
      Returns:
      the response producer.