This utility class provides an abstraction layer for sending multipart HTTP POST requests to a web server.
- Author
- www.codejava.net http://www.codejava.net/java-se/networking/upload-files-by-sending-multipart-request-programmatically
Definition at line 25 of file MultipartUtility.java.
com.introlab.rtabmap.MultipartUtility.MultipartUtility |
( |
String |
requestURL, |
|
|
String |
token, |
|
|
String |
charset |
|
) |
| throws IOException |
|
inline |
This constructor initializes a new HTTP POST request with content type is set to multipart/form-data
- Parameters
-
- Exceptions
-
Definition at line 40 of file MultipartUtility.java.
void com.introlab.rtabmap.MultipartUtility.addFilePart |
( |
String |
fieldName, |
|
|
File |
uploadFile |
|
) |
| throws IOException |
|
inline |
Adds a upload file section to the request
- Parameters
-
fieldName | name attribute in <input type="file" name="..."> |
uploadFile | a File to be uploaded |
- Exceptions
-
Definition at line 79 of file MultipartUtility.java.
void com.introlab.rtabmap.MultipartUtility.addFormField |
( |
String |
name, |
|
|
String |
value |
|
) |
| |
|
inline |
Adds a form field to the request
- Parameters
-
name | field name |
value | field value |
Definition at line 64 of file MultipartUtility.java.
void com.introlab.rtabmap.MultipartUtility.addHeaderField |
( |
String |
name, |
|
|
String |
value |
|
) |
| |
|
inline |
Adds a header field to the request.
- Parameters
-
name | - name of the header field |
value | - value of the header field |
Definition at line 113 of file MultipartUtility.java.
List<String> com.introlab.rtabmap.MultipartUtility.finish |
( |
| ) |
throws IOException |
|
inline |
Completes the request and receives response from the server.
- Returns
- a list of Strings as response in case the server returned status OK, otherwise an exception is thrown.
- Exceptions
-
Definition at line 124 of file MultipartUtility.java.
final String com.introlab.rtabmap.MultipartUtility.boundary |
|
private |
String com.introlab.rtabmap.MultipartUtility.charset |
|
private |
HttpURLConnection com.introlab.rtabmap.MultipartUtility.httpConn |
|
private |
final String com.introlab.rtabmap.MultipartUtility.LINE_FEED = "\r\n" |
|
staticprivate |
OutputStream com.introlab.rtabmap.MultipartUtility.outputStream |
|
private |
PrintWriter com.introlab.rtabmap.MultipartUtility.writer |
|
private |
The documentation for this class was generated from the following file: