Package com.basiscomponents.rest
Class MultipartPost
- java.lang.Object
-
- com.basiscomponents.rest.MultipartPost
-
public class MultipartPost extends Object
-
-
Constructor Summary
Constructors Constructor Description MultipartPost(String requestURL, String charset, Boolean ignoreSSLError)create a new HTTP POST request with content multipart/form-data
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFilePart(String fieldName, File uploadFile)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.List<String>finish()Completes the request and receives response from the server.
-
-
-
Constructor Detail
-
MultipartPost
public MultipartPost(String requestURL, String charset, Boolean ignoreSSLError) throws IOException, KeyManagementException, NoSuchAlgorithmException
create a new HTTP POST request with content multipart/form-data- Parameters:
requestURL-charset-- Throws:
IOExceptionKeyManagementExceptionNoSuchAlgorithmException
-
-
Method Detail
-
addFormField
public void addFormField(String name, String value)
Adds a form field to the request- Parameters:
name- field namevalue- field value
-
addFilePart
public void addFilePart(String fieldName, File uploadFile) throws IOException
Adds a upload file section to the request- Parameters:
fieldName- name attribute inuploadFile- a File to be uploaded- Throws:
IOException
-
addHeaderField
public void addHeaderField(String name, String value)
Adds a header field to the request.- Parameters:
name- - name of the header fieldvalue- - value of the header field
-
finish
public List<String> finish() throws IOException
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.
- Throws:
IOException
-
-