Package kong.unirest.core
Class HttpRequestMultiPart
- All Implemented Interfaces:
Body
,HttpRequest<MultipartBody>
,MultipartBody
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String
private Charset
private boolean
private MultipartMode
private ProgressMonitor
Fields inherited from class kong.unirest.core.BaseRequest
config, headers, method, url
-
Constructor Summary
ConstructorsConstructorDescriptionHttpRequestMultiPart
(HttpRequestBody httpRequest) HttpRequestMultiPart
(HttpRequestMultiPart httpRequest) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
Sets the value to use as the boundary identifier.Set the encoding of the request bodycontentType
(String mimeType) Set the mime-type of the request bodyadd a simple field with a name and valuefield
(String name, byte[] bytes, ContentType contentType, String fileName) add a simple field with a name and valueadd a simple field with a name and valueadd a simple field with a name and valuefield
(String name, InputStream stream, String fileName) add a simple field with a name and valuefield
(String name, InputStream value, ContentType contentType) add a simple field with a name and valuefield
(String name, InputStream stream, ContentType contentType, String fileName) add a simple field with a name and valueadd a simple field with a name and valueadd a simple field with a name and valuefield
(String name, String value, ContentType contentType) add a simple field with a name and valuefield
(String name, Collection<?> collection) add a simple field with a name and value(package private) MultipartBody
forceMultiPart
(boolean value) getBody()
getMode()
boolean
boolean
mode
(MultipartMode value) Set the Apache Mode.uploadMonitor
(ProgressMonitor uploadMonitor) Set a file Progress upload monitor suitable for drawing progress bars and whatnot.Methods inherited from class kong.unirest.core.BaseRequest
accept, asBytes, asBytesAsync, asBytesAsync, asEmpty, asEmptyAsync, asEmptyAsync, asFile, asFileAsync, asFileAsync, asJson, asJsonAsync, asJsonAsync, asObject, asObject, asObject, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asPaged, asString, asStringAsync, asStringAsync, basicAuth, cookie, cookie, cookie, downloadMonitor, equals, getCreationTime, getDownloadMonitor, getHeaders, getHttpMethod, getObjectMapper, getPath, getRequestTimeout, getUrl, getVersion, hashCode, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, requestTimeout, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapper
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface kong.unirest.core.HttpRequest
accept, accept, asBytes, asBytesAsync, asBytesAsync, asEmpty, asEmptyAsync, asEmptyAsync, asFile, asFileAsync, asFileAsync, asJson, asJsonAsync, asJsonAsync, asObject, asObject, asObject, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asObjectAsync, asPaged, asString, asStringAsync, asStringAsync, basicAuth, cookie, cookie, cookie, downloadMonitor, getCreationTime, getHeaders, getHttpMethod, getRequestTimeout, getUrl, getVersion, header, headerReplace, headers, headersReplace, queryString, queryString, queryString, requestTimeout, responseEncoding, routeParam, routeParam, thenConsume, thenConsumeAsync, toSummary, version, withObjectMapper
-
Field Details
-
parameters
-
mode
-
charSet
-
forceMulti
private boolean forceMulti -
monitor
-
boundary
-
-
Constructor Details
-
HttpRequestMultiPart
HttpRequestMultiPart(HttpRequestBody httpRequest) -
HttpRequestMultiPart
HttpRequestMultiPart(HttpRequestMultiPart httpRequest)
-
-
Method Details
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldvalue
- : The string value for the field- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldvalue
- : The string value for the fieldcontentType
- : the content type of the value- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldvalue
- : The string value for the fieldcontentType
- : the content type of the value- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldcollection
- : A collection of values for the same name.- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldvalue
- : A input streamcontentType
- : the content mime-type of the file- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldfile
- : A File object.- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldfile
- : A File object.contentType
- : the content mime-type of the file- Returns:
- The same MultipartBody
-
field
public MultipartBody field(String name, InputStream stream, ContentType contentType, String fileName) Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldstream
- : A input streamcontentType
- : the content mime-type of the filefileName
- : the name of the file which will be included in the file part header- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldstream
- : The raw bytes for the filefileName
- : the name of the file which will be included in the file part header- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldbytes
- : The raw bytes for the filecontentType
- : the content mime-type of the filefileName
- : the name of the file which will be included in the file part header- Returns:
- The same MultipartBody
-
field
Description copied from interface:MultipartBody
add a simple field with a name and value- Specified by:
field
in interfaceMultipartBody
- Parameters:
name
- : the Name of the form fieldbytes
- : The raw bytes for the filefileName
- : the name of the file which will be included in the file part header- Returns:
- The same MultipartBody
-
charset
Description copied from interface:MultipartBody
Set the encoding of the request body- Specified by:
charset
in interfaceMultipartBody
- Parameters:
charset
- the character set encoding of the body- Returns:
- The same MultipartBody
-
contentType
Description copied from interface:MultipartBody
Set the mime-type of the request body- Specified by:
contentType
in interfaceMultipartBody
- Parameters:
mimeType
- the mime type of the body- Returns:
- The same MultipartBody
-
mode
Description copied from interface:MultipartBody
Set the Apache Mode.- Specified by:
mode
in interfaceMultipartBody
- Parameters:
value
- the value of the mode- Returns:
- The same MultipartBody
-
uploadMonitor
Description copied from interface:MultipartBody
Set a file Progress upload monitor suitable for drawing progress bars and whatnot.- Specified by:
uploadMonitor
in interfaceMultipartBody
- Parameters:
uploadMonitor
- a monitor- Returns:
- The same MultipartBody
-
boundary
Description copied from interface:MultipartBody
Sets the value to use as the boundary identifier. see https://datatracker.ietf.org/doc/html/rfc2046- Specified by:
boundary
in interfaceMultipartBody
- Parameters:
boundaryIdentifier
- the value- Returns:
- The same MultipartBody
-
getBoundary
- Specified by:
getBoundary
in interfaceBody
-
getCharset
- Specified by:
getCharset
in interfaceBody
-
fields
-
field
-
addPart
-
addPart
-
getBody
- Specified by:
getBody
in interfaceHttpRequest<MultipartBody>
- Returns:
- if the request has a body it will be here.
-
isMultiPart
public boolean isMultiPart()- Specified by:
isMultiPart
in interfaceBody
-
isEntityBody
public boolean isEntityBody()- Specified by:
isEntityBody
in interfaceBody
-
multiParts
- Specified by:
multiParts
in interfaceBody
-
getMode
-
getMonitor
- Specified by:
getMonitor
in interfaceBody
-
forceMultiPart
-