Helps with building multipart requests
Type | Name and description |
---|---|
static java.util.Map |
COMMON_CONTENT_TYPES |
static java.util.List |
TEXT_TYPES |
Constructor and description |
---|
HttpRequestBuilder.MultipartBuilder
(io.netty.handler.codec.http.multipart.HttpPostRequestEncoder encoder, java.nio.charset.Charset charset) |
Type | Name and description |
---|---|
FormDataBuilder |
file(java.lang.String name, java.io.File file, java.lang.String contentType = guessContentType(file.name, boolean isText = guessIsText(file.name) Adds a file to the request body for the given name |
FormDataBuilder |
file(java.lang.String name, java.lang.String filename, byte[] bytes, java.lang.String contentType = guessContentType(filename) Adds a file to the request body for the given name, filename and bytes |
FormDataBuilder |
file(java.lang.String name, java.lang.String filename, java.io.InputStream bytes, int length, java.lang.String contentType = guessContentType(filename) Adds a file to the request body for the given name, filename and bytes |
FormDataBuilder |
file(java.lang.String name, java.lang.String filename, java.lang.CharSequence body, java.lang.String contentType = guessContentType(filename, java.nio.charset.Charset charset = this.charset ) Adds a file for the given name, filename and text |
protected java.lang.String |
guessContentType(java.lang.String filename, boolean binary = false) |
protected boolean |
guessIsText(java.lang.String filename) |
void |
setProperty(java.lang.String property, java.lang.Object newValue) |
Adds a file to the request body for the given name
name
- The name within the multpart bodyfile
- The file itselfcontentType
- The content type of the file. Defaults to `text/plain` for text content if not specifiedisText
- Whether the file is text or binaryAdds a file to the request body for the given name, filename and bytes
name
- The name within the multipart bodyfilename
- The file namebytes
- The bytes of the filecontentType
- The content type, defaults to 'application/octet-stream'Adds a file to the request body for the given name, filename and bytes
name
- The name within the multipart bodyfilename
- The file namebytes
- The bytes of the file as an input streamcontentType
- The content type, defaults to 'application/octet-stream'Adds a file for the given name, filename and text
name
- The name within the multipart bodyfilename
- The name of the filebody
- The body of the file as textcontentType
- The content type, defaults to `text/plain`charset
- The charset