Class JsonObjectEntityProducer<T>
java.lang.Object
org.apache.hc.core5.jackson2.http.JsonObjectEntityProducer<T>
- Type Parameters:
T- type of objects used by this class.
- All Implemented Interfaces:
EntityDetails,AsyncDataProducer,AsyncEntityProducer,ResourceHolder
AsyncEntityProducer implementation that
generates a message body containing serialized content of the given JSON object.- Since:
- 5.5
-
Constructor Summary
ConstructorsConstructorDescriptionJsonObjectEntityProducer(T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper) JsonObjectEntityProducer(T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ContentType contentType) Creates a new instance that serializes the given object using the specified content type. -
Method Summary
Modifier and TypeMethodDescriptionfinal intvoidfinal Stringfinal longfinal Stringbooleanfinal booleanfinal voidproduce(DataStreamChannel channel) void
-
Constructor Details
-
JsonObjectEntityProducer
public JsonObjectEntityProducer(T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ContentType contentType) Creates a new instance that serializes the given object using the specified content type. IfcontentTypeisnull, defaults toapplication/json.- Parameters:
jsonObject- the object to serialize.objectMapper- the object mapper.contentType- the content type, ornullforapplication/json.- Since:
- 5.5
-
JsonObjectEntityProducer
public JsonObjectEntityProducer(T jsonObject, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
-
-
Method Details
-
failed
-
getContentLength
public final long getContentLength()- Specified by:
getContentLengthin interfaceEntityDetails
-
getTrailerNames
- Specified by:
getTrailerNamesin interfaceEntityDetails
-
getContentType
- Specified by:
getContentTypein interfaceEntityDetails
-
getContentEncoding
- Specified by:
getContentEncodingin interfaceEntityDetails
-
isRepeatable
public final boolean isRepeatable()- Specified by:
isRepeatablein interfaceAsyncEntityProducer
-
isChunked
public boolean isChunked()- Specified by:
isChunkedin interfaceEntityDetails
-
available
public final int available()- Specified by:
availablein interfaceAsyncDataProducer
-
produce
- Specified by:
producein interfaceAsyncDataProducer- Throws:
IOException
-
releaseResources
public void releaseResources()- Specified by:
releaseResourcesin interfaceResourceHolder
-