public class MultipartUtility
extends java.lang.Object
| Constructor and Description |
|---|
MultipartUtility(java.lang.String requestURL,
java.lang.String method)
This constructor initializes a new HTTP request with content type
is set to multipart/form-data
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFilePart(java.lang.String fieldName,
java.io.File uploadFile)
Adds a upload file section to the request
|
void |
addFormField(java.lang.String name,
java.lang.String value)
Adds a form field to the request
|
void |
addHeaderField(java.lang.String name,
java.lang.String value)
Adds a header field to the request.
|
java.lang.String |
finish()
Completes the request and receives response from the server.
|
public MultipartUtility(java.lang.String requestURL,
java.lang.String method)
throws java.io.IOException
requestURL - - The url to which the request should be sentmethod - - The type of the HTTP request, usually POSTjava.io.IOException - - The type of the HTTP requestpublic void addFilePart(java.lang.String fieldName,
java.io.File uploadFile)
throws java.io.IOException
fieldName - - Name attributeuploadFile - - the uploadable Filejava.io.IOException - - The error what can happen during the operationpublic void addFormField(java.lang.String name,
java.lang.String value)
name - field namevalue - field valuepublic void addHeaderField(java.lang.String name,
java.lang.String value)
name - - name of the header fieldvalue - - value of the header fieldpublic java.lang.String finish()
throws java.io.IOException
java.io.IOException - - The ewrror what can happen during the operation