Modifier and Type | Field and Description |
---|---|
static MediaType |
ALTERNATIVE
The "multipart/alternative" type is syntactically identical to
"multipart/mixed", but the semantics are different.
|
static MediaType |
DIGEST
This type is syntactically identical to "multipart/mixed", but the
semantics are different.
|
static MediaType |
FORM
The media-type multipart/form-data follows the rules of all multipart
MIME data streams as outlined in RFC 2046.
|
static MediaType |
MIXED
The "mixed" subtype of "multipart" is intended for use when the body
parts are independent and need to be bundled in a particular order.
|
static MediaType |
PARALLEL
This type is syntactically identical to "multipart/mixed", but the
semantics are different.
|
Constructor and Description |
---|
MultipartBuilder()
Creates a new multipart builder that uses a random boundary token.
|
MultipartBuilder(String boundary)
Creates a new multipart builder that uses
boundary to separate
parts. |
Modifier and Type | Method and Description |
---|---|
MultipartBuilder |
addPart(Headers headers,
RequestBody body)
Add a part to the body.
|
MultipartBuilder |
addPart(RequestBody body)
Add a part to the body.
|
RequestBody |
build()
Assemble the specified parts into a request body.
|
MultipartBuilder |
type(MediaType type)
Set the MIME type.
|
public static final MediaType MIXED
public static final MediaType ALTERNATIVE
public static final MediaType DIGEST
Content-Type
value for a body part is changed from "text/plain" to
"message/rfc822".public static final MediaType PARALLEL
public static final MediaType FORM
public MultipartBuilder()
public MultipartBuilder(String boundary)
boundary
to separate
parts. Prefer the no-argument constructor to defend against injection
attacks.public MultipartBuilder type(MediaType type)
type
are MIXED
(the
default), ALTERNATIVE
, DIGEST
, PARALLEL
and
FORM
.public MultipartBuilder addPart(RequestBody body)
public MultipartBuilder addPart(Headers headers, RequestBody body)
public RequestBody build()
Copyright © 2014. All Rights Reserved.