ContentDownloadHandler Class

Use ContentDownloadHandler to define a custom download handler that controls how content is downloaded.

Sfc

The following are properties for ContentDownloadHandler.

  • downloadErrorMessage

    A customized error message explaining why the download isn’t allowed.

  • isDownloadAllowed

    Indicates whether or not download is allowed.

  • redirectUrl

    The URL the user is redirected to when the download action isn’t available, for applying Information Rights Management (IRM) control, virus scanning, or other behavior.

A customized error message explaining why the download isn’t allowed.

public String downloadErrorMessage {get; set;}

Type: String

This message is used if a redirectUrl is not provided. If the download is not allowed, Salesforce will throw a ContentCustomizedDownloadException exception that contains the downloadErrorMessage.

Indicates whether or not download is allowed.

public Boolean isDownloadAllowed {get; set;}

Type: Boolean

The URL the user is redirected to when the download action isn’t available, for applying Information Rights Management (IRM) control, virus scanning, or other behavior.

public String redirectUrl {get; set;}

Type: String

The URL must be a valid relative URL. For example, the redirect can be a custom Visualforce page such as “/apex/IRMControl”. URLs with no path, such as “www.domain.com”, results in an InvalidParameterValueException.