Interface WKDownloadDelegate


  • public interface WKDownloadDelegate
    • Method Detail

      • downloadDecideDestinationUsingResponseSuggestedFilenameCompletionHandler

        void downloadDecideDestinationUsingResponseSuggestedFilenameCompletionHandler​(@NotNull
                                                                                      @NotNull WKDownload download,
                                                                                      @NotNull
                                                                                      @NotNull NSURLResponse response,
                                                                                      @NotNull
                                                                                      @NotNull java.lang.String suggestedFilename,
                                                                                      @NotNull
                                                                                      @NotNull WKDownloadDelegate.Block_downloadDecideDestinationUsingResponseSuggestedFilenameCompletionHandler completionHandler)
        Invoked when the download needs a location to write the downloaded bytes. suggestedFilename will often be the same as response.suggestedFilename, but web content can specify the suggested download filename. If the destination file URL is non-null, it must be a file that does not exist in a directory that does exist and can be written to.
        Parameters:
        download - The download for which we need a file to which to write.
        response - The server response if this download was the result of an HTTP request, or a synthesized response for blob downloads.
        suggestedFilename - The suggested filename.
        completionHandler - The completion handler you must invoke with either a file URL to begin the download or nil to cancel the download.
      • downloadDidFailWithErrorResumeData

        default void downloadDidFailWithErrorResumeData​(@NotNull
                                                        @NotNull WKDownload download,
                                                        @NotNull
                                                        @NotNull NSError error,
                                                        @Nullable
                                                        @Nullable NSData resumeData)
        Invoked when the download has failed.
        Parameters:
        download - The download that has failed.
        error - The error indicating the failure reason.
        resumeData - This data can be passed to WKWebView resumeDownloadFromResumeData: to attempt to resume this download.
      • downloadDidReceiveAuthenticationChallengeCompletionHandler

        default void downloadDidReceiveAuthenticationChallengeCompletionHandler​(@NotNull
                                                                                @NotNull WKDownload download,
                                                                                @NotNull
                                                                                @NotNull NSURLAuthenticationChallenge challenge,
                                                                                @NotNull
                                                                                @NotNull WKDownloadDelegate.Block_downloadDidReceiveAuthenticationChallengeCompletionHandler completionHandler)
        Invoked when the download needs to respond to an authentication challenge. If you do not implement this method, the web view will respond to the authentication challenge with the NSURLSessionAuthChallengeRejectProtectionSpace disposition.
        Parameters:
        download - The download that received the authentication challenge.
        challenge - The authentication challenge.
        completionHandler - The completion handler you must invoke to respond to the challenge. The disposition argument is one of the constants of the enumerated type NSURLSessionAuthChallengeDisposition. When disposition is NSURLSessionAuthChallengeUseCredential, the credential argument is the credential to use, or nil to indicate continuing without a credential.
      • downloadWillPerformHTTPRedirectionNewRequestDecisionHandler

        default void downloadWillPerformHTTPRedirectionNewRequestDecisionHandler​(@NotNull
                                                                                 @NotNull WKDownload download,
                                                                                 @NotNull
                                                                                 @NotNull NSHTTPURLResponse response,
                                                                                 @NotNull
                                                                                 @NotNull NSURLRequest request,
                                                                                 @NotNull
                                                                                 @NotNull WKDownloadDelegate.Block_downloadWillPerformHTTPRedirectionNewRequestDecisionHandler decisionHandler)
        Invoked when the download has received an HTTP redirection response. If you do not implement this method, all server suggested redirects will be taken.
        Parameters:
        download - The download that received the redirect.
        response - The redirection response.
        newRequest - The new request that will be sent.
        completionHandler - The completion handler you must invoke to indicate whether or not to proceed with the redirection.
      • downloadDidFinish

        default void downloadDidFinish​(@NotNull
                                       @NotNull WKDownload download)
        Invoked when the download has finished successfully.
        Parameters:
        download - The download that finished.