Added in API level 1

SslErrorHandler


open class SslErrorHandler : Handler

Represents a request for handling an SSL error.

A WebView creates an instance of this class. The instance is passed to android.webkit.WebViewClient#onReceivedSslError(android.webkit.WebView,android.webkit.SslErrorHandler,SslError).

The host application must call cancel() or, contrary to secure web communication standards, proceed() to provide the web view's response to the request.

Summary

Public methods
open Unit

Instructs the WebView that encountered the SSL certificate error to terminate communication with the server.

open Unit

Instructs the WebView that encountered the SSL certificate error to ignore the error and continue communicating with the server.

Inherited functions
Handler createAsync(looper: Looper)

Create a new Handler whose posted messages and runnables are not subject to synchronization barriers such as display vsync.

Messages sent to an async handler are guaranteed to be ordered with respect to one another, but not necessarily with respect to messages from other Handlers.

Handler createAsync(looper: Looper, callback: Handler.Callback)

Create a new Handler whose posted messages and runnables are not subject to synchronization barriers such as display vsync.

Messages sent to an async handler are guaranteed to be ordered with respect to one another, but not necessarily with respect to messages from other Handlers.

Unit dispatchMessage(msg: Message)

Handle system messages here.

Unit dump(pw: Printer, prefix: String)

Looper getLooper()

String getMessageName(message: Message)

Returns a string representing the name of the specified message. The default implementation will either return the class name of the message callback if any, or the hexadecimal representation of the message "what" field.

Unit handleMessage(msg: Message)

Subclasses must implement this to receive messages.

Boolean hasCallbacks(r: Runnable)

Check if there are any pending posts of messages with callback r in the message queue.

Boolean hasMessages(what: Int)

Check if there are any pending posts of messages with code 'what' in the message queue.

Boolean hasMessages(what: Int, object: Any?)

Check if there are any pending posts of messages with code 'what' and whose obj is 'object' in the message queue.

Message obtainMessage()

Returns a new Message from the global message pool. More efficient than creating and allocating new instances. The retrieved message has its handler set to this instance (Message.target == this). If you don't want that facility, just call Message.obtain() instead.

Message obtainMessage(what: Int)

Same as obtainMessage(), except that it also sets the what member of the returned Message.

Message obtainMessage(what: Int, arg1: Int, arg2: Int)

Same as obtainMessage(), except that it also sets the what, arg1 and arg2 members of the returned Message.

Message obtainMessage(what: Int, arg1: Int, arg2: Int, obj: Any?)

Same as obtainMessage(), except that it also sets the what, obj, arg1,and arg2 values on the returned Message.

Message obtainMessage(what: Int, obj: Any?)

Same as obtainMessage(), except that it also sets the what and obj members of the returned Message.

Boolean post(r: Runnable)

Causes the Runnable r to be added to the message queue. The runnable will be run on the thread to which this handler is attached.

Boolean postAtFrontOfQueue(r: Runnable)

Posts a message to an object that implements Runnable. Causes the Runnable r to executed on the next iteration through the message queue. The runnable will be run on the thread to which this handler is attached. This method is only for use in very special circumstances -- it can easily starve the message queue, cause ordering problems, or have other unexpected side-effects.

Boolean postAtTime(r: Runnable, token: Any?, uptimeMillis: Long)

Causes the Runnable r to be added to the message queue, to be run at a specific time given by uptimeMillis. The time-base is android.os.SystemClock#uptimeMillis. Time spent in deep sleep will add an additional delay to execution. The runnable will be run on the thread to which this handler is attached.

Boolean postAtTime(r: Runnable, uptimeMillis: Long)

Causes the Runnable r to be added to the message queue, to be run at a specific time given by uptimeMillis. The time-base is android.os.SystemClock#uptimeMillis. Time spent in deep sleep will add an additional delay to execution. The runnable will be run on the thread to which this handler is attached.

Boolean postDelayed(r: Runnable, token: Any?, delayMillis: Long)

Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses. The runnable will be run on the thread to which this handler is attached. The time-base is android.os.SystemClock#uptimeMillis. Time spent in deep sleep will add an additional delay to execution.

Boolean postDelayed(r: Runnable, delayMillis: Long)

Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses. The runnable will be run on the thread to which this handler is attached. The time-base is android.os.SystemClock#uptimeMillis. Time spent in deep sleep will add an additional delay to execution.

Unit removeCallbacks(r: Runnable)

Remove any pending posts of Runnable r that are in the message queue.

Unit removeCallbacks(r: Runnable, token: Any?)

Remove any pending posts of Runnable r with Object token that are in the message queue. If token is null, all callbacks will be removed.

Unit removeCallbacksAndMessages(token: Any?)

Remove any pending posts of callbacks and sent messages whose obj is token. If token is null, all callbacks and messages will be removed.

Unit removeMessages(what: Int)

Remove any pending posts of messages with code 'what' that are in the message queue. Note that `Message#what` is 0 unless otherwise set. When calling `postMessage(Runnable)` or `postAtTime(Runnable, long)`, the `Runnable` is internally wrapped with a `Message` whose `what` is 0. Calling `removeMessages(0)` will remove all messages without a `what`, including posted `Runnable`s.

Unit removeMessages(what: Int, object: Any?)

Remove any pending posts of messages with code 'what' and whose obj is 'object' that are in the message queue. If object is null, all messages will be removed.

Boolean sendEmptyMessage(what: Int)

Sends a Message containing only the what value.

Boolean sendEmptyMessageAtTime(what: Int, uptimeMillis: Long)

Sends a Message containing only the what value, to be delivered at a specific time.

Boolean sendEmptyMessageDelayed(what: Int, delayMillis: Long)

Sends a Message containing only the what value, to be delivered after the specified amount of time elapses.

Boolean sendMessage(msg: Message)

Pushes a message onto the end of the message queue after all pending messages before the current time. It will be received in handleMessage, in the thread attached to this handler.

Boolean sendMessageAtFrontOfQueue(msg: Message)

Enqueue a message at the front of the message queue, to be processed on the next iteration of the message loop. You will receive it in handleMessage, in the thread attached to this handler. This method is only for use in very special circumstances -- it can easily starve the message queue, cause ordering problems, or have other unexpected side-effects.

Boolean sendMessageAtTime(msg: Message, uptimeMillis: Long)

Enqueue a message into the message queue after all pending messages before the absolute time (in milliseconds) uptimeMillis. The time-base is android.os.SystemClock#uptimeMillis. Time spent in deep sleep will add an additional delay to execution. You will receive it in handleMessage, in the thread attached to this handler.

Boolean sendMessageDelayed(msg: Message, delayMillis: Long)

Enqueue a message into the message queue after all pending messages before (current time + delayMillis). You will receive it in handleMessage, in the thread attached to this handler.

String toString()

Public methods

cancel

Added in API level 1
open fun cancel(): Unit

Instructs the WebView that encountered the SSL certificate error to terminate communication with the server. Cancels the current server request and all pending requests for the WebView.

The host application must call this method to prevent a resource from loading when an SSL certificate is invalid.

See Also

    proceed

    Added in API level 1
    open fun proceed(): Unit

    Instructs the WebView that encountered the SSL certificate error to ignore the error and continue communicating with the server.

    Warning: When an SSL error occurs, the host application should always call cancel() rather than proceed() because an invalid SSL certificate means the connection is not secure.

    See Also