com.sun.jndi.rmi.registry.RegistryContext Java Examples
The following examples show how to use
com.sun.jndi.rmi.registry.RegistryContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextWithNullProperties.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #2
Source File: ContextWithNullProperties.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #3
Source File: ContextWithNullProperties.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #4
Source File: ContextWithNullProperties.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #5
Source File: ContextWithNullProperties.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #6
Source File: ContextWithNullProperties.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #7
Source File: ContextWithNullProperties.java From hottub with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #8
Source File: ContextWithNullProperties.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnEphemeralPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #9
Source File: ContextWithNullProperties.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #10
Source File: ContextWithNullProperties.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #11
Source File: ContextWithNullProperties.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #12
Source File: ContextWithNullProperties.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #13
Source File: ContextWithNullProperties.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { Registry registry = TestLibrary.createRegistryOnUnusedPort(); int registryPort = TestLibrary.getRegistryPort(registry); System.out.println("Connecting to the default Registry..."); // Connect to the default Registry. // Pass null as the JNDI environment properties (see final argument) RegistryContext ctx = new RegistryContext(null, registryPort, null); }
Example #14
Source File: rmiURLContext.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #15
Source File: rmiURLContext.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #16
Source File: rmiURLContext.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #17
Source File: rmiURLContext.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #18
Source File: rmiURLContext.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #19
Source File: rmiURLContext.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #20
Source File: rmiURLContext.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #21
Source File: rmiURLContext.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #22
Source File: rmiURLContext.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #23
Source File: rmiURLContext.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #24
Source File: rmiURLContext.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #25
Source File: rmiURLContext.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }
Example #26
Source File: rmiURLContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Resolves the registry portion of "url" to the corresponding * RMI registry, and returns the atomic object name as the * remaining name. */ protected ResolveResult getRootURLContext(String url, Hashtable<?,?> env) throws NamingException { if (!url.startsWith("rmi:")) { throw (new IllegalArgumentException( "rmiURLContext: name is not an RMI URL: " + url)); } // Parse the URL. String host = null; int port = -1; String objName = null; int i = 4; // index into url, following the "rmi:" if (url.startsWith("//", i)) { // parse "//host:port" i += 2; // skip past "//" int slash = url.indexOf('/', i); if (slash < 0) { slash = url.length(); } if (url.startsWith("[", i)) { // at IPv6 literal int brac = url.indexOf(']', i + 1); if (brac < 0 || brac > slash) { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } host = url.substring(i, brac + 1); // include brackets i = brac + 1; // skip past "[...]" } else { // at host name or IPv4 int colon = url.indexOf(':', i); int hostEnd = (colon < 0 || colon > slash) ? slash : colon; if (i < hostEnd) { host = url.substring(i, hostEnd); } i = hostEnd; // skip past host } if ((i + 1 < slash)) { if ( url.startsWith(":", i)) { // parse port i++; // skip past ":" port = Integer.parseInt(url.substring(i, slash)); } else { throw new IllegalArgumentException( "rmiURLContext: name is an Invalid URL: " + url); } } i = slash; } if ("".equals(host)) { host = null; } if (url.startsWith("/", i)) { // skip "/" before object name i++; } if (i < url.length()) { objName = url.substring(i); } // Represent object name as empty or single-component composite name. CompositeName remaining = new CompositeName(); if (objName != null) { remaining.add(objName); } // Debug //System.out.println("host=" + host + " port=" + port + // " objName=" + remaining.toString() + "\n"); // Create a registry context. Context regCtx = new RegistryContext(host, port, env); return (new ResolveResult(regCtx, remaining)); }