public class BinaryUploadRequest extends HttpUploadRequest
Constructor and Description |
---|
BinaryUploadRequest(Context context,
String serverUrl)
Creates a new binaryupload request and automatically generates an upload id, that will
be returned when you call
HttpUploadRequest.startUpload() . |
BinaryUploadRequest(Context context,
String uploadId,
String serverUrl)
Creates a binary file upload request.
|
Modifier and Type | Method and Description |
---|---|
HttpUploadRequest |
addArrayParameter(String paramName,
List<String> list)
Adds a parameter with multiple values to this upload request.
|
HttpUploadRequest |
addArrayParameter(String paramName,
String... array)
Adds a parameter with multiple values to this upload request.
|
BinaryUploadRequest |
addHeader(String headerName,
String headerValue)
Adds a header to this upload request.
|
HttpUploadRequest |
addParameter(String paramName,
String paramValue)
Adds a parameter to this upload request.
|
BinaryUploadRequest |
setAutoDeleteFilesAfterSuccessfulUpload(boolean autoDeleteFiles)
Sets the automatic file deletion after successful upload.
|
BinaryUploadRequest |
setBasicAuth(String username,
String password)
Sets the HTTP Basic Authentication header.
|
BinaryUploadRequest |
setCustomUserAgent(String customUserAgent)
Sets the custom user agent to use for this upload request.
|
BinaryUploadRequest |
setFileToUpload(String path)
Sets the file used as raw body of the upload request.
|
BinaryUploadRequest |
setMaxRetries(int maxRetries)
Sets the maximum number of retries that the library will do if an error occurs,
before returning an error.
|
BinaryUploadRequest |
setMethod(String method)
Sets the HTTP method to use.
|
BinaryUploadRequest |
setNotificationConfig(UploadNotificationConfig config)
Sets custom notification configuration.
|
BinaryUploadRequest |
setUsesFixedLengthStreamingMode(boolean fixedLength)
Sets if this upload request is using fixed length streaming mode.
|
startUpload
public BinaryUploadRequest(Context context, String uploadId, String serverUrl)
context
- application contextuploadId
- unique ID to assign to this upload request.UploadServiceBroadcastReceiver
,
you know to which upload they refer to.serverUrl
- URL of the server side script that will handle the multipart form upload.
E.g.: http://www.yourcompany.com/your/scriptpublic BinaryUploadRequest(Context context, String serverUrl)
HttpUploadRequest.startUpload()
.context
- application contextserverUrl
- URL of the server side script that will handle the multipart form upload.
E.g.: http://www.yourcompany.com/your/scriptpublic BinaryUploadRequest setFileToUpload(String path) throws FileNotFoundException
path
- Absolute path to the file that you want to uploadBinaryUploadRequest
FileNotFoundException
- if the file to upload does not existpublic BinaryUploadRequest setNotificationConfig(UploadNotificationConfig config)
HttpUploadRequest
setNotificationConfig
in class HttpUploadRequest
config
- the upload configuration object or null if you don't want a notification
to be displayedHttpUploadRequest
public BinaryUploadRequest setAutoDeleteFilesAfterSuccessfulUpload(boolean autoDeleteFiles)
HttpUploadRequest
setAutoDeleteFilesAfterSuccessfulUpload
in class HttpUploadRequest
autoDeleteFiles
- true to auto delete files included in the
request when the upload is completed successfully.
By default this setting is set to false, and nothing gets deleted.HttpUploadRequest
public BinaryUploadRequest addHeader(String headerName, String headerValue)
HttpUploadRequest
addHeader
in class HttpUploadRequest
headerName
- header nameheaderValue
- header valueHttpUploadRequest
public BinaryUploadRequest setBasicAuth(String username, String password)
HttpUploadRequest
setBasicAuth
in class HttpUploadRequest
username
- HTTP Basic Auth usernamepassword
- HTTP Basic Auth passwordHttpUploadRequest
public BinaryUploadRequest setMethod(String method)
HttpUploadRequest
setMethod
in class HttpUploadRequest
method
- new HTTP method to useHttpUploadRequest
public BinaryUploadRequest setCustomUserAgent(String customUserAgent)
HttpUploadRequest
setCustomUserAgent
in class HttpUploadRequest
customUserAgent
- custom user agent stringHttpUploadRequest
public BinaryUploadRequest setMaxRetries(int maxRetries)
HttpUploadRequest
setMaxRetries
in class HttpUploadRequest
maxRetries
- number of maximum retries on errorHttpUploadRequest
public BinaryUploadRequest setUsesFixedLengthStreamingMode(boolean fixedLength)
HttpUploadRequest
HttpUploadTask.getBodyLength()
will be automatically used to properly set the
underlying HttpURLConnection
, otherwise chunked streaming mode will be used.setUsesFixedLengthStreamingMode
in class HttpUploadRequest
fixedLength
- true to use fixed length streaming mode (this is the default setting) or
false to use chunked streaming mode.HttpUploadRequest
public HttpUploadRequest addParameter(String paramName, String paramValue)
HttpUploadRequest
addParameter
in class HttpUploadRequest
paramName
- parameter nameparamValue
- parameter valueHttpUploadRequest
public HttpUploadRequest addArrayParameter(String paramName, String... array)
HttpUploadRequest
addArrayParameter
in class HttpUploadRequest
paramName
- parameter namearray
- valuesHttpUploadRequest
public HttpUploadRequest addArrayParameter(String paramName, List<String> list)
HttpUploadRequest
addArrayParameter
in class HttpUploadRequest
paramName
- parameter namelist
- valuesHttpUploadRequest