public class MultipartBody extends BaseRequest implements Body
| Modifier and Type | Field and Description |
|---|---|
private boolean |
hasFile |
private HttpRequest |
httpRequestObj |
private Map<String,Object> |
parameters |
httpRequest, UTF_8| Constructor and Description |
|---|
MultipartBody(HttpRequest httpRequest)
Creates the Multipart body from the given request.
|
| Modifier and Type | Method and Description |
|---|---|
MultipartBody |
basicAuth(String username,
String password)
Sets the basic authentication.
|
MultipartBody |
field(String name,
File file)
Adds an upload file.
|
MultipartBody |
field(String name,
String value)
Adds a field.
|
org.apache.http.HttpEntity |
getEntity()
Computes the request payload.
|
static List<org.apache.http.NameValuePair> |
getList(Map<String,Object> parameters)
A helper method to build a list a
NameValuePair from a map of parameters. |
asBinary, asBinaryAsync, asBinaryAsync, asHtml, asJson, asJsonAsync, asJsonAsync, asString, asStringAsync, asStringAsyncprivate boolean hasFile
private HttpRequest httpRequestObj
public MultipartBody(HttpRequest httpRequest)
httpRequest - the base request, must not be null.public MultipartBody field(String name, String value)
name - the field's namevalue - the valuepublic MultipartBody field(String name, File file)
name - the field's namefile - the file to uploadpublic MultipartBody basicAuth(String username, String password)
username - the usernamepassword - the passwordpublic org.apache.http.HttpEntity getEntity()
Copyright © 2013–2014 Wisdom Framework. All rights reserved.