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
UploadRequest.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 try 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.
|
setDelegate, startUploadpublic 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)
UploadRequest.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 - path to the file that you want to uploadBinaryUploadRequestFileNotFoundException - if the file to upload does not existpublic BinaryUploadRequest setNotificationConfig(UploadNotificationConfig config)
UploadRequestsetNotificationConfig in class UploadRequestconfig - the upload configuration object or null if you don't want a notification
to be displayedUploadRequestpublic BinaryUploadRequest setAutoDeleteFilesAfterSuccessfulUpload(boolean autoDeleteFiles)
UploadRequestsetAutoDeleteFilesAfterSuccessfulUpload in class UploadRequestautoDeleteFiles - 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.UploadRequestpublic BinaryUploadRequest addHeader(String headerName, String headerValue)
HttpUploadRequestaddHeader in class HttpUploadRequestheaderName - header nameheaderValue - header valueHttpUploadRequestpublic BinaryUploadRequest setBasicAuth(String username, String password)
HttpUploadRequestsetBasicAuth in class HttpUploadRequestusername - HTTP Basic Auth usernamepassword - HTTP Basic Auth passwordHttpUploadRequestpublic BinaryUploadRequest setMethod(String method)
HttpUploadRequestsetMethod in class HttpUploadRequestmethod - new HTTP method to useHttpUploadRequestpublic BinaryUploadRequest setCustomUserAgent(String customUserAgent)
HttpUploadRequestsetCustomUserAgent in class HttpUploadRequestcustomUserAgent - custom user agent stringHttpUploadRequestpublic BinaryUploadRequest setMaxRetries(int maxRetries)
UploadRequestsetMaxRetries in class UploadRequestmaxRetries - number of maximum retries on errorUploadRequestpublic BinaryUploadRequest setUsesFixedLengthStreamingMode(boolean fixedLength)
HttpUploadRequestHttpUploadTask.getBodyLength() will be automatically used to properly set the
underlying HttpURLConnection, otherwise chunked streaming mode will be used.setUsesFixedLengthStreamingMode in class HttpUploadRequestfixedLength - true to use fixed length streaming mode (this is the default setting) or
false to use chunked streaming mode.HttpUploadRequestpublic HttpUploadRequest addParameter(String paramName, String paramValue)
HttpUploadRequestaddParameter in class HttpUploadRequestparamName - parameter nameparamValue - parameter valueHttpUploadRequestpublic HttpUploadRequest addArrayParameter(String paramName, String... array)
HttpUploadRequestaddArrayParameter in class HttpUploadRequestparamName - parameter namearray - valuesHttpUploadRequestpublic HttpUploadRequest addArrayParameter(String paramName, List<String> list)
HttpUploadRequestaddArrayParameter in class HttpUploadRequestparamName - parameter namelist - valuesHttpUploadRequest