Class Request
Definition
- Namespace:
- Tizen.Content.Download
- Assembly:
- Tizen.Content.Download.dll
- API Level:
- 3
The Request class provides the functions to create and manage a single download request.
public class Request : IDisposable
- Inheritance
-
Request
- Implements
Constructors
View SourceRequest(String)
Creates a Request object.
Declaration
public Request(string url)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL to download. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceRequest(String, String, String, NetworkType)
Creates a Request object.
Declaration
public Request(string url, string destinationPath, string fileName, NetworkType type)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL to download |
String | destinationPath | The directory path where downloaded file is stored. |
String | fileName | The name of the downloaded file. |
NetworkType | type | The network type which the download request must adhere to. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
NotSupportedException | Thrown when a feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
View SourceRequest(String, String, String, NetworkType, IDictionary<String, String>)
Creates a Request object.
Declaration
public Request(string url, string destinationPath, string fileName, NetworkType type, IDictionary<string, string> httpHeaders)
Parameters
Type | Name | Description |
---|---|---|
String | url | The URL to download. |
String | destinationPath | The directory path where the downloaded file is stored. |
String | fileName | The name of the downloaded file. |
NetworkType | type | The network type which the download request must adhere to. |
IDictionary<String, String> | httpHeaders | HTTP header fields for the download request. |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
NotSupportedException | Thrown when a feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
Properties
View SourceAllowedNetworkType
The allowed network type for downloading the file. The file will be downloaded only under the allowed network. If you try to get this property value before setting or if any other error occurs, the default value NetworkType All is returned.
Declaration
public NetworkType AllowedNetworkType { get; set; }
Property Value
Type | Description |
---|---|
NetworkType |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
NotSupportedException | Thrown when feature is not supported. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Feature: http://tizen.org/feature/network.wifihttp://tizen.org/feature/network.wifi.directhttp://tizen.org/feature/network.telephony
View SourceAutoDownload
Enables or disables auto download. If this option is enabled, the previous downloading item is restarted automatically as soon as the download daemon is restarted. The download progress continues after the client process is terminated. If you try to get this property value before setting, the default value false is returned.
Declaration
public bool AutoDownload { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
The default value is false.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceContentName
The content name of the downloaded file. This can be defined with reference of the HTTP response header data. The content name can be received when the HTTP response header is received. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
public string ContentName { get; }
Property Value
Type | Description |
---|---|
String |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceContentSize
The total size of the downloaded content. This information is received from the server. If the server does not send the total size of the content, the content size is set to zero. If you try to get this property value before calling Start(), 0 is returned.
Declaration
public ulong ContentSize { get; }
Property Value
Type | Description |
---|---|
UInt64 |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceDestinationPath
The file will be downloaded to the set the destination file path. The downloaded file is saved to an auto-generated file name in the destination. If the destination is not specified, the file will be downloaded to the default storage. If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Declaration
public string DestinationPath { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceDownloadedPath
The absolute path where the file will be downloaded. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
public string DownloadedPath { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
Returns an empty string if the download is not completed or if a state has not yet changed to completed or if any other error occurs.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceETagValue
The ETag value from the HTTP response header when making a HTTP request for resume. If you try to get this property value before calling Start() or if any other error occurs, an empty string is returned.
Declaration
public string ETagValue { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
The ETag value is either available or not dependent on the web server. If not available, then, on getting the property, a null value is returned. After the download is started, it can get the ETag value.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceFileName
The file will be saved in the specified destination or the default storage with the set file name. If the file name is not specified, the downloaded file will be saved with an auto-generated file name in the destination. If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
Should be set before calling Start().
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceHttpHeaders
The HTTP header field and value pairs to the download request. The HTTP header <field,value> pair is the <key,value> pair in the dictionary HttpHeaders. The given HTTP header field will be included with the HTTP request of the download request. If you try to get this property value before setting, an empty dictionary is returned.
Declaration
public IDictionary<string, string> HttpHeaders { get; }
Property Value
Type | Description |
---|---|
IDictionary<String, String> |
Remarks
HTTP header fields should be set before calling Start(). HTTP header fields can be removed before calling Start().
API Level: 3
View SourceHttpStatus
The HTTP status code when a download exception occurs. If you try to get this property value before calling Start(), 0 is returned.
Declaration
public int HttpStatus { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
The state of the download request must be DownlodState.Failed.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceMimeType
The MIME type of the downloaded content. If you try to get this property value before calling Start(), an empty string is returned.
Declaration
public string MimeType { get; }
Property Value
Type | Description |
---|---|
String |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceNotificationProperties
Contains properties required for creating download notifications.
Declaration
public Notification NotificationProperties { get; }
Property Value
Type | Description |
---|---|
Notification |
Remarks
When the notification message is clicked, the action taken by the system is decided by the application control properties of the NotificationProperties instance. If the app control is not set, the following default operation is executed when the notification message is clicked: 1) The download completed state - the viewer application is executed according to the extension name of the downloaded content. 2) The download failed state and ongoing state - the client application is executed. This property should be set before calling Start().
API Level: 3
View SourceState
The current state of the download.
Declaration
public DownloadState State { get; }
Property Value
Type | Description |
---|---|
DownloadState |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceTemporaryPath
The full path of the temporary file stores the downloaded content.
Declaration
public string TemporaryPath { get; }
Property Value
Type | Description |
---|---|
String |
Remarks
The download state must be one of the states after downloading.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceUrl
The URL to download.
Declaration
public string Url { get; set; }
Property Value
Type | Description |
---|---|
String |
Remarks
Should be set before calling Start(). If you try to get this property value before setting or if any other error occurs, an empty string is returned.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Methods
View SourceCancel()
Cancels the download request.
Declaration
public void Cancel()
Remarks
The canceled download can be restarted with Start().
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceDispose()
Releases all the resources used by the Request class.
Declaration
public void Dispose()
Remarks
After calling this method, the download request related data exists in the download database for a certain period of time. Within that time, it is possible to use other APIs with this data.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceDispose(Boolean)
Deletes the corresponding download request.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceFinalize()
Destructor of the Request class.
Declaration
protected void Finalize()
Pause()
Pauses the download request.
Declaration
public void Pause()
Remarks
The paused download request can be restarted with Start() or canceled with Cancel().
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceSetTemporaryFilePath(String)
Sets the directory path of a temporary file used in a previous download request. This is only useful when resuming download to make the HTTP request header at the client side. Otherwise, the path is ignored.
Declaration
public void SetTemporaryFilePath(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path |
Remarks
If the ETag value is not present in the download database, it is not useful to set the temporary file path. When resuming the download request, the data is attached at the end of this temporary file.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceStart()
Starts or resumes the download. Starts to download the current URL, or resumes the download if paused.
Declaration
public void Start()
Remarks
The URL is the mandatory information to start the download.
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
Events
View SourceProgressChanged
An event that occurs when the download progress changes.
Declaration
public event EventHandler<ProgressChangedEventArgs> ProgressChanged
Event Type
Type | Description |
---|---|
EventHandler<ProgressChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |
API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/download
View SourceStateChanged
An event that occurs when the download state changes.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
EventHandler<StateChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when it is failed due to an invalid parameter. |
InvalidOperationException | Thrown when it is failed due to an invalid operation. |
UnauthorizedAccessException | Thrown when a permission is denied. |