Expose DNS Servers via public API

Norman Maurer norman.maurer at googlemail.com
Thu Mar 30 15:43:23 UTC 2017


Nice!


This works :)
Norman
> On 30. Mar 2017, at 17:27, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 30/03/2017 15:59, Norman Maurer wrote:
> 
>> Thats why I tried to kick-off the topic :) Thanks for the quick reply btw…. So is this list the right place for this discussion ?
>> 
> I just checked the docs for the JNDI-DNS provider [1] and it documents that the provider updates the java.naming.provider.url property with the configuration when it isn't initially specified. So I think this will do what you want:
> 
> Hashtable<String, String> env = new Hashtable<>();
> env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.dns.DnsContextFactory");
> env.put("java.naming.provider.url", "dns://");
> DirContext ctx = new InitialDirContext(env);
> String dnsUrls = (String) ctx.getEnvironment().get("java.naming.provider.url"));
> 
> -Alan
> 
> [1] http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-dns.html



More information about the net-dev mailing list