public abstract class HttpUploadRequest<B extends HttpUploadRequest<B>> extends UploadRequest<B>
Constructor and Description |
---|
HttpUploadRequest(Context context,
String uploadId,
String serverUrl)
Creates a new http upload request.
|
Modifier and Type | Method and Description |
---|---|
B |
addArrayParameter(String paramName,
List<String> list)
Adds a parameter with multiple values to this upload request.
|
B |
addArrayParameter(String paramName,
String... array)
Adds a parameter with multiple values to this upload request.
|
B |
addHeader(String headerName,
String headerValue)
Adds a header to this upload request.
|
B |
addParameter(String paramName,
String paramValue)
Adds a parameter to this upload request.
|
B |
setBasicAuth(String username,
String password)
Sets the HTTP Basic Authentication header.
|
B |
setCustomUserAgent(String customUserAgent)
Sets the custom user agent to use for this upload request.
|
B |
setMethod(String method)
Sets the HTTP method to use.
|
B |
setUsesFixedLengthStreamingMode(boolean fixedLength)
Sets if this upload request is using fixed length streaming mode.
|
setAutoDeleteFilesAfterSuccessfulUpload, setDelegate, setMaxRetries, setNotificationConfig, startUpload
public HttpUploadRequest(Context context, String uploadId, String serverUrl) throws MalformedURLException, IllegalArgumentException
context
- application contextuploadId
- unique ID to assign to this upload request. If is null or empty, a random
UUID will be automatically generated. It's used in the broadcast receiver
when receiving updates.serverUrl
- URL of the server side script that handles the requestIllegalArgumentException
- if one or more arguments are not validMalformedURLException
- if the server URL is not validpublic B addHeader(String headerName, String headerValue)
headerName
- header nameheaderValue
- header valuepublic B setBasicAuth(String username, String password)
username
- HTTP Basic Auth usernamepassword
- HTTP Basic Auth passwordpublic B addParameter(String paramName, String paramValue)
paramName
- parameter nameparamValue
- parameter valuepublic B addArrayParameter(String paramName, String... array)
paramName
- parameter namearray
- valuespublic B addArrayParameter(String paramName, List<String> list)
paramName
- parameter namelist
- valuespublic B setMethod(String method)
method
- new HTTP method to usepublic B setCustomUserAgent(String customUserAgent)
customUserAgent
- custom user agent stringpublic B setUsesFixedLengthStreamingMode(boolean fixedLength)
HttpUploadTask.getBodyLength()
will be automatically used to properly set the
underlying HttpURLConnection
, otherwise chunked streaming mode will be used.fixedLength
- true to use fixed length streaming mode (this is the default setting) or
false to use chunked streaming mode.