Most visited

Recently visited

Added in API level 24

SNIMatcher

public abstract class SNIMatcher
extends Object

java.lang.Object
    javax.net.ssl.SNIMatcher


此类的实例表示一个匹配器,它在 SNIServerName实例上执行匹配操作。

服务器可以使用服务器名称指示(SNI)信息来决定特定的SSLSocketSSLEngine实例是否应该接受连接。 例如,当多个“虚拟”或“基于名称”的服务器托管在单个底层网络地址上时,服务器应用程序可以使用SNI信息来确定此服务器是否是客户端要访问的确切服务器。 服务器可以使用此类的实例来验证特定类型的可接受服务器名称,例如主机名。

SNIMatcher对象是不可变的。 子类不应该提供可以在创建实例后更改实例状态的方法。

也可以看看:

摘要(Summary)

Protected constructors

SNIMatcher(int type)

使用指定的服务器名称类型创建一个 SNIMatcher

公共方法(Public methods)

final int getType()

返回此 SNIMatcher对象的服务器名称类型。

abstract boolean matches(SNIServerName serverName)

尝试匹配给定的 SNIServerName

继承方法(Inherited methods)

From class java.lang.Object

Protected constructors

SNIMatcher

Added in API level 24
SNIMatcher (int type)

使用指定的服务器名称类型创建 SNIMatcher

参数(Parameters)
type int: the type of the server name that this matcher performs on
抛出异常(Throws)
IllegalArgumentException if type is not in the range of 0 to 255, inclusive.

公共方法(Public methods)

getType

Added in API level 24
int getType ()

返回此 SNIMatcher对象的服务器名称类型。

返回(Returns)
int the server name type of this SNIMatcher object.

也可以看看:

matches

Added in API level 24
boolean matches (SNIServerName serverName)

尝试匹配给定的 SNIServerName

参数(Parameters)
serverName SNIServerName: the SNIServerName instance on which this matcher performs match operations
返回(Returns)
boolean true if, and only if, the matcher matches the given serverName
抛出异常(Throws)
NullPointerException if serverName is null
IllegalArgumentException if serverName is not of the given server name type of this matcher

也可以看看:

Hooray!