1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| private static void scanDomain() {
try {
Hashtable<String,String> env = new Hashtable<String,String>();
env.put("java.naming.factory.initial",
"com.sun.jndi.dns.DnsContextFactory");
env.put("java.naming.provider.url",
"dns://monServeur");
Context ictx = new InitialContext(env);
NamingEnumeration<Binding> e = ictx.listBindings("monDomaine");
while (e.hasMore()) {
Binding b = e.next();
System.out.println("name: " + b.getName());
System.out.println("object: " + b.getObject());
}
} catch (javax.naming.NamingException e) {
System.err.println("Exception " + e);
}
} |
Partager