SNIMatcher
Stay organized with collections
Save and categorize content based on your preferences.
Instances of this class represent a matcher that performs match
operations on an SNIServerName
instance.
Servers can use Server Name Indication (SNI) information to decide if
specific SSLSocket
or SSLEngine
instances should accept
a connection. For example, when multiple "virtual" or "name-based"
servers are hosted on a single underlying network address, the server
application can use SNI information to determine whether this server is
the exact server that the client wants to access. Instances of this
class can be used by a server to verify the acceptable server names of
a particular type, such as host names.
SNIMatcher
objects are immutable. Subclasses should not provide
methods that can change the state of an instance once it has been created.
Protected Constructor Summary
|
SNIMatcher(int type)
Creates an SNIMatcher using the specified server name type.
|
Public Method Summary
final
int
|
getType()
Returns the server name type of this SNIMatcher object.
|
abstract
boolean
|
|
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Protected Constructors
protected
SNIMatcher
(int type)
Creates an SNIMatcher
using the specified server name type.
Parameters
type |
the type of the server name that this matcher performs on |
Public Methods
public
final
int
getType
()
Returns the server name type of this SNIMatcher
object.
Returns
- the server name type of this
SNIMatcher
object.
public
abstract
boolean
matches
(SNIServerName serverName)
Parameters
serverName |
the SNIServerName instance on which this matcher
performs match operations |
Returns
true
if, and only if, the matcher matches the
given serverName
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eSNIMatcher\u003c/code\u003e is an abstract class used to match Server Name Indication (SNI) information during SSL/TLS handshakes.\u003c/p\u003e\n"],["\u003cp\u003eIt helps servers determine if a connection should be accepted based on the client's desired server name.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSNIMatcher\u003c/code\u003e objects are immutable and provide methods to get the server name type and to perform the matching operation.\u003c/p\u003e\n"],["\u003cp\u003eServers can utilize \u003ccode\u003eSNIMatcher\u003c/code\u003e to support multiple virtual or name-based servers on a single network address.\u003c/p\u003e\n"]]],[],null,["public abstract class **SNIMatcher** extends [Object](../../../../reference/java/lang/Object.html) \nInstances of this class represent a matcher that performs match\noperations on an [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html) instance.\n\n\nServers can use Server Name Indication (SNI) information to decide if\nspecific [SSLSocket](../../../../reference/javax/net/ssl/SSLSocket.html) or [SSLEngine](../../../../reference/javax/net/ssl/SSLEngine.html) instances should accept\na connection. For example, when multiple \"virtual\" or \"name-based\"\nservers are hosted on a single underlying network address, the server\napplication can use SNI information to determine whether this server is\nthe exact server that the client wants to access. Instances of this\nclass can be used by a server to verify the acceptable server names of\na particular type, such as host names.\n\n\n`SNIMatcher` objects are immutable. Subclasses should not provide\nmethods that can change the state of an instance once it has been created. \n\nSee Also\n\n- [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html)\n- [SNIHostName](../../../../reference/javax/net/ssl/SNIHostName.html)\n- [SSLParameters.getSNIMatchers()](../../../../reference/javax/net/ssl/SSLParameters.html#getSNIMatchers())\n- [SSLParameters.setSNIMatchers(Collection)](../../../../reference/javax/net/ssl/SSLParameters.html#setSNIMatchers(java.util.Collection\u003cjavax.net.ssl.SNIMatcher\u003e)) \n\nProtected Constructor Summary\n\n|---|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [SNIMatcher](../../../../reference/javax/net/ssl/SNIMatcher.html#SNIMatcher(int))(int type) Creates an `SNIMatcher` using the specified server name type. |\n\nPublic Method Summary\n\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| final int | [getType](../../../../reference/javax/net/ssl/SNIMatcher.html#getType())() Returns the server name type of this `SNIMatcher` object. |\n| abstract boolean | [matches](../../../../reference/javax/net/ssl/SNIMatcher.html#matches(javax.net.ssl.SNIServerName))([SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html) serverName) Attempts to match the given [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html). |\n\nInherited Method Summary \nFrom class [java.lang.Object](../../../../reference/java/lang/Object.html) \n\n|----------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Object](../../../../reference/java/lang/Object.html) | [clone](../../../../reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |\n| boolean | [equals](../../../../reference/java/lang/Object.html#equals(java.lang.Object))([Object](../../../../reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |\n| void | [finalize](../../../../reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |\n| final [Class](../../../../reference/java/lang/Class.html)\\\u003c?\\\u003e | [getClass](../../../../reference/java/lang/Object.html#getClass())() Returns the unique instance of [Class](../../../../reference/java/lang/Class.html) that represents this object's class. |\n| int | [hashCode](../../../../reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |\n| final void | [notify](../../../../reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| final void | [notifyAll](../../../../reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| [String](../../../../reference/java/lang/String.html) | [toString](../../../../reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../../reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |\n\nProtected Constructors \n\nprotected\n**SNIMatcher**\n(int type) \nCreates an `SNIMatcher` using the specified server name type. \n\nParameters\n\n| type | the type of the server name that this matcher performs on |\n|------|-----------------------------------------------------------|\n\nThrows\n\n| [IllegalArgumentException](../../../../reference/java/lang/IllegalArgumentException.html) | if `type` is not in the range of 0 to 255, inclusive. |\n|-------------------------------------------------------------------------------------------|-------------------------------------------------------|\n\nPublic Methods \n\npublic final int\n**getType**\n() \nReturns the server name type of this `SNIMatcher` object. \n\nReturns\n\n- the server name type of this `SNIMatcher` object. \n\nSee Also\n\n- [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html) \n\npublic abstract boolean\n**matches**\n([SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html) serverName) \nAttempts to match the given [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html). \n\nParameters\n\n| serverName | the [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html) instance on which this matcher performs match operations |\n|------------|--------------------------------------------------------------------------------------------------------------------------------------|\n\nReturns\n\n- `true` if, and only if, the matcher matches the given `serverName` \n\nThrows\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if `serverName` is `null` |\n| [IllegalArgumentException](../../../../reference/java/lang/IllegalArgumentException.html) | if `serverName` is not of the given server name type of this matcher |\n|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------|\n\nSee Also\n\n- [SNIServerName](../../../../reference/javax/net/ssl/SNIServerName.html)"]]