本文整理汇总了Java中sun.misc.SharedSecrets.getJavaNetAccess方法的典型用法代码示例。如果您正苦于以下问题:Java SharedSecrets.getJavaNetAccess方法的具体用法?Java SharedSecrets.getJavaNetAccess怎么用?Java SharedSecrets.getJavaNetAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.misc.SharedSecrets
的用法示例。
在下文中一共展示了SharedSecrets.getJavaNetAccess方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: useImplicitHost
import sun.misc.SharedSecrets; //导入方法依赖的package包/类
private synchronized void useImplicitHost(boolean noSniUpdate) {
// Note: If the local name service is not trustworthy, reverse
// host name resolution should not be performed for endpoint
// identification. Use the application original specified
// hostname or IP address instead.
// Get the original hostname via jdk.internal.misc.SharedSecrets
InetAddress inetAddress = getInetAddress();
if (inetAddress == null) { // not connected
return;
}
JavaNetAccess jna = SharedSecrets.getJavaNetAccess();
String originalHostname = jna.getOriginalHostName(inetAddress);
if ((originalHostname != null) &&
(originalHostname.length() != 0)) {
host = originalHostname;
if (!noSniUpdate && serverNames.isEmpty() && !noSniExtension) {
serverNames =
Utilities.addToSNIServerNameList(serverNames, host);
if (!roleIsServer &&
(handshaker != null) && !handshaker.started()) {
handshaker.setSNIServerNames(serverNames);
}
}
return;
}
// No explicitly specified hostname, no server name indication.
if (!trustNameService) {
// The local name service is not trustworthy, use IP address.
host = inetAddress.getHostAddress();
} else {
// Use the underlying reverse host name resolution service.
host = getInetAddress().getHostName();
}
}