Package org.apache.juneau.http
Class HttpResources
java.lang.Object
org.apache.juneau.http.HttpResources
Standard predefined HTTP resources.
Resources are simply HttpEntity objects with arbitrary additional headers.
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final ByteArrayResourcebyteArrayResource(byte[] content) Creates a newByteArrayResourcebuilder.static final ByteArrayResourcebyteArrayResource(byte[] content, ContentType contentType) Creates a newByteArrayResourcebuilder.static final ByteArrayResourcebyteArrayResource(Supplier<byte[]> content) Creates a newByteArrayResourcebuilder.static final ByteArrayResourcebyteArrayResource(Supplier<byte[]> content, ContentType contentType) Creates a newByteArrayResourcebuilder.static final FileResourcefileResource(File content) Creates a newFileResourcebuilder.static final FileResourcefileResource(File content, ContentType contentType) Creates a newFileResourcebuilder.static final ReaderResourcereaderResource(Reader content) Creates a newReaderResourcebuilder.static final ReaderResourcereaderResource(Reader content, ContentType contentType) Creates a newReaderResourcebuilder.static final StreamResourcestreamResource(InputStream content) Creates a newStreamResourcebuilder.static final StreamResourcestreamResource(InputStream content, long length, ContentType contentType) Creates a newStreamResourcebuilder.static final StringResourcestringResource(String content) Creates a new builder for aStringResourcebuilder.static final StringResourcestringResource(String content, ContentType contentType) Creates a new builder for aStringResourcebuilder.static final StringResourcestringResource(Supplier<String> content) Creates a new builder for aStringResourcebuilder.static final StringResourcestringResource(Supplier<String> content, ContentType contentType) Creates a new builder for aStringResourcebuilder.
-
Constructor Details
-
HttpResources
public HttpResources()
-
-
Method Details
-
byteArrayResource
Creates a newByteArrayResourcebuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
ByteArrayResourcebuilder.
-
byteArrayResource
Creates a newByteArrayResourcebuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ByteArrayResourcebuilder.
-
byteArrayResource
Creates a newByteArrayResourcebuilder.Assumes no content type.
- Parameters:
content- The entity content supplier. Can benull .- Returns:
- A new
ByteArrayResourcebuilder.
-
byteArrayResource
public static final ByteArrayResource byteArrayResource(Supplier<byte[]> content, ContentType contentType) Creates a newByteArrayResourcebuilder.- Parameters:
content- The entity content supplier. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ByteArrayResourcebuilder.
-
fileResource
Creates a newFileResourcebuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
FileResourcebuilder.
-
fileResource
Creates a newFileResourcebuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
FileResourcebuilder.
-
readerResource
Creates a newReaderResourcebuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
ReaderResourcebuilder.
-
readerResource
Creates a newReaderResourcebuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
ReaderResourcebuilder.
-
streamResource
Creates a newStreamResourcebuilder.Assumes no content type.
- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StreamResourcebuilder.
-
streamResource
public static final StreamResource streamResource(InputStream content, long length, ContentType contentType) Creates a newStreamResourcebuilder.- 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
StreamResourcebuilder.
-
stringResource
Creates a new builder for aStringResourcebuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StringResourcebuilder.
-
stringResource
Creates a new builder for aStringResourcebuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
StringResourcebuilder.
-
stringResource
Creates a new builder for aStringResourcebuilder.- Parameters:
content- The entity content. Can benull .- Returns:
- A new
StringResourcebuilder.
-
stringResource
public static final StringResource stringResource(Supplier<String> content, ContentType contentType) Creates a new builder for aStringResourcebuilder.- Parameters:
content- The entity content. Can benull .contentType- The entity content type, ornull if not specified.- Returns:
- A new
StringResourcebuilder.
-