Search in sources :

Example 1 with FilePart

use of com.koushikdutta.async.http.body.FilePart in project ion by koush.

the class IonRequestBuilder method setMultipartFile.

@Override
public IonRequestBuilder setMultipartFile(String name, String contentType, File file) {
    if (multipartBody == null) {
        multipartBody = new MultipartFormDataBody();
        setBody(multipartBody);
    }
    FilePart part = new FilePart(name, file);
    if (contentType == null)
        contentType = AsyncHttpServer.tryGetContentType(file.getAbsolutePath());
    if (contentType != null)
        part.setContentType(contentType);
    multipartBody.addPart(part);
    return this;
}
Also used : MultipartFormDataBody(com.koushikdutta.async.http.body.MultipartFormDataBody) FilePart(com.koushikdutta.async.http.body.FilePart)

Aggregations

FilePart (com.koushikdutta.async.http.body.FilePart)1 MultipartFormDataBody (com.koushikdutta.async.http.body.MultipartFormDataBody)1