ResolverConfig (dnsjava documentation)
Date: 2013-04-10

org.xbill.DNS

## Class ResolverConfig

- java.lang.Object
- - org.xbill.DNS.ResolverConfig

-     public class ResolverConfig
      extends Object

  A class that tries to locate name servers and the search path to be appended to unqualified names. The following are attempted, in order, until one succeeds.
  - The properties 'dns.server' and 'dns.search' (comma delimited lists) are checked. The servers can either be IP addresses or hostnames (which are resolved using Java's built in DNS support).
  - The sun.net.dns.ResolverConfiguration class is queried.
  - On Unix, /etc/resolv.conf is parsed.
  - On Windows, ipconfig/winipcfg is called and its output parsed. This may fail for non-English versions on Windows.
  - "localhost" is used as the nameserver, and the search path is empty.
  These routines will be called internally when creating Resolvers/Lookups without explicitly specifying server names, and can also be called directly if desired.
  Author:
    Brian Wellington, Yannick Meudal, Arnt Gulbrandsen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ResolverConfig()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static ResolverConfig` | `getCurrentConfig()` Gets the current configuration
    `int` | `ndots()` Returns the located ndots value, or the default (1) if not configured.
    `static void` | `refresh()` Gets the current configuration
    `Name[]` | `searchPath()` Returns all entries in the located search path
    `String` | `server()` Returns the first located server
    `String[]` | `servers()` Returns all located servers

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ResolverConfig

          public ResolverConfig()

  - ### Method Detail

    - #### servers

          public String[] servers()

      Returns all located servers

    - #### server

          public String server()

      Returns the first located server

    - #### searchPath

          public Name[] searchPath()

      Returns all entries in the located search path

    - #### ndots

          public int ndots()

      Returns the located ndots value, or the default (1) if not configured. Note that ndots can only be configured in a resolv.conf file, and will only take effect if ResolverConfig uses resolv.conf directly (that is, if the JVM does not include the sun.net.dns.ResolverConfiguration class).

    - #### getCurrentConfig

          public static ResolverConfig getCurrentConfig()

      Gets the current configuration

    - #### refresh

          public static void refresh()

      Gets the current configuration