Package org.apache.juneau.http
Class HttpEntities
java.lang.Object
org.apache.juneau.http.HttpEntities
Standard predefined HTTP entities.
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier 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
-
HttpEntities
public HttpEntities()
-
-
Method Details
-
byteArrayEntity
Creates a newByteArrayEntitybuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
ByteArrayEntitybuilder.
-
byteArrayEntity
Creates a newByteArrayEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ByteArrayEntitybuilder.
-
byteArrayEntity
Creates a newByteArrayEntitybuilder.Assumes no content type.
- Parameters:
content- The entity content supplier. Can benull .- Returns:
- A new
ByteArrayEntitybuilder.
-
byteArrayEntity
public static final ByteArrayEntity byteArrayEntity(Supplier<byte[]> content, ContentType contentType) Creates a newByteArrayEntitybuilder.- Parameters:
content- The entity content supplier. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ByteArrayEntitybuilder.
-
fileEntity
Creates a newFileEntitybuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
FileEntitybuilder.
-
fileEntity
Creates a newFileEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
FileEntitybuilder.
-
readerEntity
Creates a newReaderEntitybuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
ReaderEntitybuilder.
-
readerEntity
Creates a newReaderEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ReaderEntitybuilder.
-
serializedEntity
Creates a newSerializedEntityobject.- Parameters:
content- The Java POJO representing the content.
Can benull .serializer- The serializer to use to serialize the POJO.
Ifnull , POJO will be converted to a string usingObject.toString().- Returns:
- A new
SerializedEntityobject.
-
serializedEntity
public static final SerializedEntity serializedEntity(Object content, Serializer serializer, HttpPartSchema schema) Creates a newSerializedEntityobject.- Parameters:
content- The Java POJO representing the content.
Can benull .serializer- The serializer to use to serialize the POJO.
Ifnull , POJO will be converted to a string usingObject.toString().schema- Optional HTTP-part schema for providing instructionst to the serializer on the format of the entity.- Returns:
- A new
SerializedEntityobject.
-
serializedEntity
Creates a newSerializedEntityobject.- Parameters:
content- The supplier of a Java POJO representing the content.
Can benull .serializer- The serializer to use to serialize the POJO.
Ifnull , POJO will be converted to a string usingObject.toString().- Returns:
- A new
SerializedEntityobject.
-
serializedEntity
public 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 benull .serializer- The serializer to use to serialize the POJO.
Ifnull , POJO will be converted to a string usingObject.toString().schema- Optional HTTP-part schema for providing instructionst to the serializer on the format of the entity.- Returns:
- A new
SerializedEntityobject.
-
streamEntity
Creates a newStreamEntitybuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StreamEntitybuilder.
-
streamEntity
public static final StreamEntity streamEntity(InputStream content, long length, ContentType contentType) Creates a newStreamEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.length- The content length, or-1 if not known.- Returns:
- A new
StreamEntitybuilder.
-
stringEntity
Creates a new builder for aStringEntitybuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StringEntitybuilder.
-
stringEntity
Creates a new builder for aStringEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
StringEntitybuilder.
-
stringEntity
Creates a new builder for aStringEntitybuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StringEntitybuilder.
-
stringEntity
Creates a new builder for aStringEntitybuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
StringEntitybuilder.
-