Package org.javalite.http
Class Multipart
java.lang.Object
org.javalite.http.Request
org.javalite.http.Multipart
Sets up a Multipart request to send multiple text fields as well as upload files.
- Author:
- Igor Polevoy on 5/1/16.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends Request>
TdoConnect(HttpURLConnection connection)
Convenience method to add a form field to the request.Adds a form field to the requestConvenience method to add multiple fields to the request.Convenience method to add a file fields to the request.protected String
static void
Methods inherited from class org.javalite.http.Request
applicationJson, basic, basic, bytes, connect, contentType, dispose, getInputStream, header, headers, jsonList, jsonList, jsonMap, jsonMap, param, params, params, redirect, responseCode, responseMessage, text, text
-
Constructor Details
-
Multipart
Constructor to make multipart requests- Parameters:
url
- URL to send request toconnectTimeout
- connection timeoutreadTimeout
- read timeout
-
-
Method Details
-
doConnect
- Overrides:
doConnect
in classRequest
- Throws:
IOException
-
getMethod
-
field
Adds a form field to the request- Parameters:
field
- instance of form field- Returns:
- self
-
field
Convenience method to add a form field to the request.- Parameters:
name
- name of fieldvalue
- value of field- Returns:
- self
-
fields
Convenience method to add multiple fields to the request. Names and values alternate: name1, value1, name2, value2, etc.- Parameters:
namesAndValues
- names/values of multiple fields to be added to the request.- Returns:
- self
-
file
Convenience method to add a file fields to the request.- Parameters:
fieldName
- name of fieldfilePath
- fully qualified path to a file.- Returns:
- self.
-
main
-