Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
JDK 11 jdk.naming.dns.jmod - Naming DNS Module
JDK 11 jdk.naming.dns.jmod is the JMOD file for JDK 11 Naming DNS module.
JDK 11 Naming DNS module compiled class files are stored in \fyicenter\jdk-11.0.1\jmods\jdk.naming.dns.jmod.
JDK 11 Naming DNS module compiled class files are also linked and stored in the \fyicenter\jdk-11.0.1\lib\modules JImage file.
JDK 11 Naming DNS module source code files are stored in \fyicenter\jdk-11.0.1\lib\src.zip\jdk.naming.dns.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/jndi/dns/DnsContextFactory.java
/* * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.jndi.dns; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import javax.naming.*; import javax.naming.spi.*; import com.sun.jndi.toolkit.url.UrlUtil; import sun.net.dns.ResolverConfiguration; // available since 1.4.1 /** * A DnsContextFactory serves as the initial context factory for DNS. * * <p> When an initial context is being created, the environment * property "java.naming.provider.url" should contain a DNS pseudo-URL * (see DnsUrl) or a space-separated list of them. Multiple URLs must * all have the same domain value. * If the property is not set, the default "dns:" is used. * * @author Scott Seligman */ public class DnsContextFactory implements InitialContextFactory { private static final String DEFAULT_URL = "dns:"; private static final int DEFAULT_PORT = 53; public Context getInitialContext(Hashtable<?,?> env) throws NamingException { if (env == null) { env = new Hashtable<>(5); } return urlToContext(getInitCtxUrl(env), env); } public static DnsContext getContext(String domain, String[] servers, Hashtable<?,?> env) throws NamingException { return new DnsContext(domain, servers, env); } /* * "urls" are used to determine the servers, but any domain * components are overridden by "domain". */ public static DnsContext getContext(String domain, DnsUrl[] urls, Hashtable<?,?> env) throws NamingException { String[] servers = serversForUrls(urls); DnsContext ctx = getContext(domain, servers, env); if (platformServersUsed(urls)) { ctx.setProviderUrl(constructProviderUrl(domain, servers)); } return ctx; } /* * Public for use by product test suite. */ public static boolean platformServersAvailable() { return !filterNameServers( ResolverConfiguration.open().nameservers(), true ).isEmpty(); } private static Context urlToContext(String url, Hashtable<?,?> env) throws NamingException { DnsUrl[] urls; try { urls = DnsUrl.fromList(url); } catch (MalformedURLException e) { throw new ConfigurationException(e.getMessage()); } if (urls.length == 0) { throw new ConfigurationException( "Invalid DNS pseudo-URL(s): " + url); } String domain = urls[0].getDomain(); // If multiple urls, all must have the same domain. for (int i = 1; i < urls.length; i++) { if (!domain.equalsIgnoreCase(urls[i].getDomain())) { throw new ConfigurationException( "Conflicting domains: " + url); } } return getContext(domain, urls, env); } /* * Returns all the servers specified in a set of URLs. * If a URL has no host (or port), the servers configured on the * underlying platform are used if possible. If no configured * servers can be found, then fall back to the old behavior of * using "localhost". * There must be at least one URL. */ private static String[] serversForUrls(DnsUrl[] urls) throws NamingException { if (urls.length == 0) { throw new ConfigurationException("DNS pseudo-URL required"); } List<String> servers = new ArrayList<>(); for (int i = 0; i < urls.length; i++) { String server = urls[i].getHost(); int port = urls[i].getPort(); if (server == null && port < 0) { // No server or port given, so look to underlying platform. // ResolverConfiguration does some limited caching, so the // following is reasonably efficient even if called rapid-fire. List<String> platformServers = filterNameServers( ResolverConfiguration.open().nameservers(), false); if (!platformServers.isEmpty()) { servers.addAll(platformServers); continue; // on to next URL (if any, which is unlikely) } } if (server == null) { server = "localhost"; } servers.add((port < 0) ? server : server + ":" + port); } return servers.toArray(new String[servers.size()]); } /* * Returns true if serversForUrls(urls) would make use of servers * from the underlying platform. */ private static boolean platformServersUsed(DnsUrl[] urls) { if (!platformServersAvailable()) { return false; } for (int i = 0; i < urls.length; i++) { if (urls[i].getHost() == null && urls[i].getPort() < 0) { return true; } } return false; } /* * Returns a value for the PROVIDER_URL property (space-separated URL * Strings) that reflects the given domain and servers. * Each server is of the form "server[:port]". * There must be at least one server. * IPv6 literal host names include delimiting brackets. */ private static String constructProviderUrl(String domain, String[] servers) { String path = ""; if (!domain.equals(".")) { try { path = "/" + UrlUtil.encode(domain, "ISO-8859-1"); } catch (java.io.UnsupportedEncodingException e) { // assert false : "ISO-Latin-1 charset unavailable"; } } StringBuilder sb = new StringBuilder(); for (int i = 0; i < servers.length; i++) { if (i > 0) { sb.append(' '); } sb.append("dns://").append(servers[i]).append(path); } return sb.toString(); } /* * Reads environment to find URL(s) of initial context. * Default URL is "dns:". */ private static String getInitCtxUrl(Hashtable<?,?> env) { String url = (String) env.get(Context.PROVIDER_URL); return ((url != null) ? url : DEFAULT_URL); } /** * Removes any DNS server that's not permitted to access * @param input the input server[:port] list, must not be null * @param oneIsEnough return output once there exists one ok * @return the filtered list, all non-permitted input removed */ private static List<String> filterNameServers(List<String> input, boolean oneIsEnough) { SecurityManager security = System.getSecurityManager(); if (security == null || input == null || input.isEmpty()) { return input; } else { List<String> output = new ArrayList<>(); for (String platformServer: input) { int colon = platformServer.indexOf(':', platformServer.indexOf(']') + 1); int p = (colon < 0) ? DEFAULT_PORT : Integer.parseInt( platformServer.substring(colon + 1)); String s = (colon < 0) ? platformServer : platformServer.substring(0, colon); try { security.checkConnect(s, p); output.add(platformServer); if (oneIsEnough) { return output; } } catch (SecurityException se) { continue; } } return output; } } }
⏎ com/sun/jndi/dns/DnsContextFactory.java
Or download all of them as a single archive file:
File name: jdk.naming.dns-11.0.1-src.zip File size: 45078 bytes Release date: 2018-11-04 Download
⇒ JDK 11 jdk.naming.rmi.jmod - Naming RMI Module
2020-06-21, 7823👍, 0💬
Popular Posts:
Apache BCEL Source Code Files are inside the Apache BCEL source package file like bcel-6.6.1-src.zip...
xml-commons Resolver Source Code Files are provided in the source package file, xml-commons-resolver...
JDK 11 jdk.jdeps.jmod is the JMOD file for JDK 11 JDeps tool, which can be invoked by the "jdeps" co...
JDK 11 jdk.crypto.mscapi.jmod is the JMOD file for JDK 11 Crypto MSCAPI module. JDK 11 Crypto MSCAPI...
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...