Class NetworkSettings

java.lang.Object
org.openide.util.NetworkSettings

public final class NetworkSettings extends Object
Useful static methods for getting Network Proxy required for make network connection for specified resource.
Since:
8.13
  • Constructor Details

    • NetworkSettings

      public NetworkSettings()
  • Method Details

    • getProxyHost

      public static String getProxyHost(URI u)
      Returns the hostname part of network proxy address based on given URI to access the resource at. Returns null for direct connection.
      Parameters:
      u - The URI that a connection is required to
      Returns:
      the hostname part of the Proxy address or null
    • getProxyPort

      public static String getProxyPort(URI u)
      Returns the port part of network proxy address based on given URI to access the resource at. Returns null for direct connection.
      Parameters:
      u - The URI that a connection is required to
      Returns:
      the port part of the Proxy address or null
    • getAuthenticationUsername

      public static String getAuthenticationUsername(URI u)
      Returns the username for Proxy Authentication. Returns null if no authentication required.
      Parameters:
      u - The URI that a connection is required to
      Returns:
      username for Proxy Authentication or null
    • getAuthenticationPassword

      public static char[] getAuthenticationPassword(URI u)
      Returns the password for Proxy Authentication. Returns null if no authentication required.
      Parameters:
      u - The URI that a connection is required to
      Returns:
      password for Proxy Authentication
      Since:
      9.8
    • getKeyForAuthenticationPassword

      @Deprecated public static String getKeyForAuthenticationPassword(URI u)
      Returns the key for reading password for Proxy Authentication. Use org.netbeans.api.keyring.Keyring for reading the password from the ring. Returns null if no authentication required.
      Parameters:
      u - The URI that a connection is required to
      Returns:
      the key for reading password for Proxy Authentication from the ring or null
    • suppressAuthenticationDialog

      public static <R> R suppressAuthenticationDialog(Callable<R> blockOfCode) throws Exception
      Suppress asking user a question about the authentication credentials while running blockOfCode. It's a contract with NetBeans implementation of Authenticator. In case a system is using other Authenticator implementation, it must call isAuthenticationDialogSuppressed() method.
      Parameters:
      blockOfCode - Callable containing code which will be executed while authentication is suppressed
      Returns:
      a result of calling of blockOfCode and may throw an exception.
      Throws:
      Exception
      Since:
      8.17
      See Also:
    • isAuthenticationDialogSuppressed

      public static boolean isAuthenticationDialogSuppressed()
      A utility method for implementations of Authenticator to suppress asking users a authentication question while running code posted in #authenticationDialogSuppressed.
      Returns:
      true while running code posted in #authenticationDialogSuppressed method.
      Since:
      8.17
      See Also:
      • authenticationDialogSuppressed