Package nxt.util
Class MultipartUtility
java.lang.Object
nxt.util.MultipartUtility
-
Constructor Summary
ConstructorsConstructorDescriptionMultipartUtility(URL url, Charset charset) This constructor initializes a new HTTP POST request with content type is set to multipart/form-data -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFilePart(String fieldName, String fileName, byte[] data) Adds a upload file section to the requestvoidaddFormField(String name, String value) Adds a form field to the requestvoidaddHeaderField(String name, String value) Adds a header field to the request.finish()Completes the request and receives response from the server.
-
Constructor Details
-
MultipartUtility
This constructor initializes a new HTTP POST request with content type is set to multipart/form-data- Parameters:
url- urlcharset- character set
-
-
Method Details
-
addFormField
Adds a form field to the request- Parameters:
name- field namevalue- field value
-
addFilePart
Adds a upload file section to the request- Parameters:
fieldName- name attribute in <input type="file" name="..." />fileName- name of filedata- file bytes
-
addHeaderField
Adds a header field to the request. Unused for now.- Parameters:
name- - name of the header fieldvalue- - value of the header field
-
finish
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.
-