ResourceHandler.HandleResourceAsync
Contents
[
Hide
]ResourceHandler.HandleResourceAsync method
This method is responsible for handling the resource asynchronously when the document is saved with a SaveAsync method. In it you can save the Resource to the stream or embed it into the parent resource, and then complete the work asynchronously, for example write the saved content to a remote storage.
public virtual Task HandleResourceAsync(Resource resource, ResourceHandlingContext context,
CancellationToken cancellationToken)
| Parameter | Type | Description |
|---|---|---|
| resource | Resource | The Resource which will be handled. |
| context | ResourceHandlingContext | Resource handling context. |
| cancellationToken | CancellationToken | The cancellation token. |
Return Value
A task that represents the asynchronous part of the handling.
Exceptions
| exception | condition |
|---|---|
| OperationCanceledException | Operation was cancelled. |
Remarks
Save or Embed must be called before the method returns (before its first await), because the reference to the resource is written to the parent resource as soon as the method returns. The returned task is awaited when the document has been serialized. The default implementation calls HandleResource.
See Also
- class Resource
- class ResourceHandlingContext
- class ResourceHandler
- namespace Aspose.Html.Saving.ResourceHandlers
- assembly Aspose.HTML