Package org.apache.juneau.http
Class HttpEntities
java.lang.Object
org.apache.juneau.http.HttpEntities
Standard predefined HTTP entities.
 
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic final ByteArrayEntitybyteArrayEntity(byte[] content) Creates a newByteArrayEntitybuilder.static final ByteArrayEntitybyteArrayEntity(byte[] content, ContentType contentType) Creates a newByteArrayEntitybuilder.static final ByteArrayEntitybyteArrayEntity(Supplier<byte[]> content) Creates a newByteArrayEntitybuilder.static final ByteArrayEntitybyteArrayEntity(Supplier<byte[]> content, ContentType contentType) Creates a newByteArrayEntitybuilder.static final FileEntityfileEntity(File content) Creates a newFileEntitybuilder.static final FileEntityfileEntity(File content, ContentType contentType) Creates a newFileEntitybuilder.static final ReaderEntityreaderEntity(Reader content) Creates a newReaderEntitybuilder.static final ReaderEntityreaderEntity(Reader content, ContentType contentType) Creates a newReaderEntitybuilder.static final SerializedEntityserializedEntity(Object content, Serializer serializer) Creates a newSerializedEntityobject.static final SerializedEntityserializedEntity(Object content, Serializer serializer, HttpPartSchema schema) Creates a newSerializedEntityobject.static final SerializedEntityserializedEntity(Supplier<?> content, Serializer serializer) Creates a newSerializedEntityobject.static final SerializedEntityserializedEntity(Supplier<?> content, Serializer serializer, HttpPartSchema schema) Creates a newSerializedEntityobject.static final StreamEntitystreamEntity(InputStream content) Creates a newStreamEntitybuilder.static final StreamEntitystreamEntity(InputStream content, long length, ContentType contentType) Creates a newStreamEntitybuilder.static final StringEntitystringEntity(String content) Creates a new builder for aStringEntitybuilder.static final StringEntitystringEntity(String content, ContentType contentType) Creates a new builder for aStringEntitybuilder.static final StringEntitystringEntity(Supplier<String> content) Creates a new builder for aStringEntitybuilder.static final StringEntitystringEntity(Supplier<String> content, ContentType contentType) Creates a new builder for aStringEntitybuilder.
- 
Constructor Details- 
HttpEntitiespublic HttpEntities()
 
- 
- 
Method Details- 
byteArrayEntityCreates a newByteArrayEntitybuilder.Assumes no content type. - Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new ByteArrayEntitybuilder.
 
- 
byteArrayEntityCreates a newByteArrayEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new ByteArrayEntitybuilder.
 
- 
byteArrayEntityCreates a newByteArrayEntitybuilder.Assumes no content type. - Parameters:
- content- The entity content supplier. Can be- null .
- Returns:
- A new ByteArrayEntitybuilder.
 
- 
byteArrayEntitypublic static final ByteArrayEntity byteArrayEntity(Supplier<byte[]> content, ContentType contentType) Creates a newByteArrayEntitybuilder.- Parameters:
- content- The entity content supplier. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new ByteArrayEntitybuilder.
 
- 
fileEntityCreates a newFileEntitybuilder.Assumes no content type. - Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new FileEntitybuilder.
 
- 
fileEntityCreates a newFileEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new FileEntitybuilder.
 
- 
readerEntityCreates a newReaderEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new ReaderEntitybuilder.
 
- 
readerEntityCreates a newReaderEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new ReaderEntitybuilder.
 
- 
serializedEntityCreates a newSerializedEntityobject.- Parameters:
- content- The Java POJO representing the content.
 Can be- null .
- serializer- The serializer to use to serialize the POJO.
 If- null , POJO will be converted to a string using- Object.toString().
- Returns:
- A new SerializedEntityobject.
 
- 
serializedEntityCreates a newSerializedEntityobject.- Parameters:
- content- The supplier of a Java POJO representing the content.
 Can be- null .
- serializer- The serializer to use to serialize the POJO.
 If- null , POJO will be converted to a string using- Object.toString().
- Returns:
- A new SerializedEntityobject.
 
- 
serializedEntitypublic static final SerializedEntity serializedEntity(Object content, Serializer serializer, HttpPartSchema schema) Creates a newSerializedEntityobject.- Parameters:
- content- The Java POJO representing the content.
 Can be- null .
- serializer- The serializer to use to serialize the POJO.
 If- null , POJO will be converted to a string using- Object.toString().
- schema- Optional HTTP-part schema for providing instructionst to the serializer on the format of the entity.
- Returns:
- A new SerializedEntityobject.
 
- 
serializedEntitypublic static final SerializedEntity serializedEntity(Supplier<?> content, Serializer serializer, HttpPartSchema schema) Creates a newSerializedEntityobject.- Parameters:
- content- The supplier of a Java POJO representing the content.
 Can be- null .
- serializer- The serializer to use to serialize the POJO.
 If- null , POJO will be converted to a string using- Object.toString().
- schema- Optional HTTP-part schema for providing instructionst to the serializer on the format of the entity.
- Returns:
- A new SerializedEntityobject.
 
- 
streamEntityCreates a newStreamEntitybuilder.Assumes no content type. - Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new StreamEntitybuilder.
 
- 
streamEntitypublic static final StreamEntity streamEntity(InputStream content, long length, ContentType contentType) Creates a newStreamEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- length- The content length, or- -1 if not known.
- Returns:
- A new StreamEntitybuilder.
 
- 
stringEntityCreates a new builder for aStringEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new StringEntitybuilder.
 
- 
stringEntityCreates a new builder for aStringEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new StringEntitybuilder.
 
- 
stringEntityCreates a new builder for aStringEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- Returns:
- A new StringEntitybuilder.
 
- 
stringEntityCreates a new builder for aStringEntitybuilder.- Parameters:
- content- The entity content. Can be- null .
- contentType- The entity content type, or- null if not specified.
- Returns:
- A new StringEntitybuilder.
 
 
-