Package org.apache.juneau.http.entity
Class SerializedEntity
java.lang.Object
org.apache.juneau.http.entity.BasicHttpEntity
org.apache.juneau.http.entity.SerializedEntity
- All Implemented Interfaces:
- HttpEntity
HttpEntity for serializing POJOs as the body of HTTP requests.
 
See Also:
- 
Field SummaryFields inherited from class org.apache.juneau.http.entity.BasicHttpEntityEMPTY
- 
Constructor SummaryConstructorsConstructorDescriptionConstructor.SerializedEntity(SerializedEntity copyFrom) Copy constructor.SerializedEntity(ContentType contentType, Object content, Serializer serializer, HttpPartSchema schema) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptioncopy()Creates a builder for this class initialized with the contents of this bean.copyWith(Serializer serializer, HttpPartSchema schema) Copies this bean and sets the serializer and schema on it.longbooleanSpecifies that the contents of this resource should be cached into an internal byte array so that it can be read multiple times.setCharset(Charset value) Specifies the charset to use when converting to and from stream-based resources.Sets the 'chunked' flag value totrue .setChunked(boolean value) Sets the 'chunked' flag value.setContent(Object value) Sets the content on this entity bean.setContent(Supplier<?> value) Sets the content on this entity bean from a supplier.setContentEncoding(String value) Sets the content encoding header on this entity bean.Sets the content encoding header on this entity bean.setContentLength(long value) Sets the content length on this entity bean.setContentType(String value) Sets the content type on this entity bean.setContentType(ContentType value) Sets the content type on this entity bean.setMaxLength(int value) Specifies the maximum number of bytes to read or write to and from stream-based resources.setSchema(HttpPartSchema value) Sets the schema on this entity bean.setSerializer(Serializer value) Sets the serializer on this entity bean.Specifies whether this bean should be unmodifiable.voidwriteTo(OutputStream os) Methods inherited from class org.apache.juneau.http.entity.BasicHttpEntityasBytes, asSafeBytes, assertBytes, assertModifiable, assertString, asString, consumeContent, contentOrElse, getCharset, getContentEncoding, getMaxLength, isCached, isChunked, isStreaming, isSupplied, isUnmodifiable
- 
Constructor Details- 
SerializedEntitypublic SerializedEntity()Constructor.
- 
SerializedEntitypublic SerializedEntity(ContentType contentType, Object content, Serializer serializer, HttpPartSchema schema) Constructor.- Parameters:
- contentType- The entity content type.
- content- The entity content.
- serializer- The entity serializer.
- schema- The entity schema. Can be- null .
 
- 
SerializedEntityCopy constructor.- Parameters:
- copyFrom- The bean being copied.
 
 
- 
- 
Method Details- 
copyCreates a builder for this class initialized with the contents of this bean.Allows you to create a modifiable copy of this bean. - Overrides:
- copyin class- BasicHttpEntity
- Returns:
- A new builder bean.
 
- 
copyWithCopies this bean and sets the serializer and schema on it.- Parameters:
- serializer- The new serializer for the bean. Can be- null .
- schema- The new schema for the bean. Can be- null .
- Returns:
- Either a new bean with the serializer set, or this bean if
   both values are null or the serializer and schema were already set.
 
- 
setSerializerSets the serializer on this entity bean.- Parameters:
- value- The entity serializer, can be- null .
- Returns:
- This object.
 
- 
setSchemaSets the schema on this entity bean.Used to provide instructions to the serializer on how to serialize this object. - Parameters:
- value- The entity schema, can be- null .
- Returns:
- This object.
 
- 
getContentType- Specified by:
- getContentTypein interface- HttpEntity
- Overrides:
- getContentTypein class- BasicHttpEntity
 
- 
writeTo- Specified by:
- writeToin interface- HttpEntity
- Overrides:
- writeToin class- BasicHttpEntity
- Throws:
- IOException
 
- 
isRepeatable- Specified by:
- isRepeatablein interface- HttpEntity
- Overrides:
- isRepeatablein class- BasicHttpEntity
 
- 
getContentLength- Specified by:
- getContentLengthin interface- HttpEntity
- Overrides:
- getContentLengthin class- BasicHttpEntity
 
- 
getContent- Specified by:
- getContentin interface- HttpEntity
- Overrides:
- getContentin class- BasicHttpEntity
 
- 
setCachedDescription copied from class:BasicHttpEntitySpecifies that the contents of this resource should be cached into an internal byte array so that it can be read multiple times.- Overrides:
- setCachedin class- BasicHttpEntity
- Returns:
- This object.
- Throws:
- IOException- If entity could not be read into memory.
 
- 
setCharsetDescription copied from class:BasicHttpEntitySpecifies the charset to use when converting to and from stream-based resources.- Overrides:
- setCharsetin class- BasicHttpEntity
- Parameters:
- value- The new value. If- null ,- UTF-8 is assumed.
- Returns:
- This object.
 
- 
setChunkedDescription copied from class:BasicHttpEntitySets the 'chunked' flag value totrue .Notes:- If the HttpEntity.getContentLength()method returns a negative value, the HttpClient code will always use chunked encoding.
 - Overrides:
- setChunkedin class- BasicHttpEntity
- Returns:
- This object.
 
- If the 
- 
setChunkedDescription copied from class:BasicHttpEntitySets the 'chunked' flag value.Notes:- If the HttpEntity.getContentLength()method returns a negative value, the HttpClient code will always use chunked encoding.
 - Overrides:
- setChunkedin class- BasicHttpEntity
- Parameters:
- value- The new value for this flag.
- Returns:
- This object.
 
- If the 
- 
setContentDescription copied from class:BasicHttpEntitySets the content on this entity bean.- Overrides:
- setContentin class- BasicHttpEntity
- Parameters:
- value- The entity content, can be- null .
- Returns:
- This object.
 
- 
setContentDescription copied from class:BasicHttpEntitySets the content on this entity bean from a supplier.Repeatable entities such as StringEntityuse this to allow the entity content to be resolved at serialization time.- Overrides:
- setContentin class- BasicHttpEntity
- Parameters:
- value- The entity content, can be- null .
- Returns:
- This object.
 
- 
setContentEncodingDescription copied from class:BasicHttpEntitySets the content encoding header on this entity bean.- Overrides:
- setContentEncodingin class- BasicHttpEntity
- Parameters:
- value- The new- Content-Encoding header, or- null to unset.
- Returns:
- This object.
 
- 
setContentEncodingDescription copied from class:BasicHttpEntitySets the content encoding header on this entity bean.- Overrides:
- setContentEncodingin class- BasicHttpEntity
- Parameters:
- value- The new- Content-Encoding header, or- null to unset.
- Returns:
- This object.
 
- 
setContentLengthDescription copied from class:BasicHttpEntitySets the content length on this entity bean.- Overrides:
- setContentLengthin class- BasicHttpEntity
- Parameters:
- value- The new- Content-Length header value, or- -1 to unset.
- Returns:
- This object.
 
- 
setContentTypeDescription copied from class:BasicHttpEntitySets the content type on this entity bean.- Overrides:
- setContentTypein class- BasicHttpEntity
- Parameters:
- value- The new- Content-Type header, or- null to unset.
- Returns:
- This object.
 
- 
setContentTypeDescription copied from class:BasicHttpEntitySets the content type on this entity bean.- Overrides:
- setContentTypein class- BasicHttpEntity
- Parameters:
- value- The new- Content-Type header, or- null to unset.
- Returns:
- This object.
 
- 
setMaxLengthDescription copied from class:BasicHttpEntitySpecifies the maximum number of bytes to read or write to and from stream-based resources.Implementation is not universal. - Overrides:
- setMaxLengthin class- BasicHttpEntity
- Parameters:
- value- The new value. The default is- -1 which means read everything.
- Returns:
- This object.
 
- 
setUnmodifiableDescription copied from class:BasicHttpEntitySpecifies whether this bean should be unmodifiable.When enabled, attempting to set any properties on this bean will cause an UnsupportedOperationException.- Overrides:
- setUnmodifiablein class- BasicHttpEntity
- Returns:
- This object.
 
 
-