org.openide.util 8.19.1

org.openide.util
Class NetworkSettings

java.lang.Object
  extended by 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

Nested Class Summary
static class NetworkSettings.ProxyCredentialsProvider
          Allows NetBeans Platform users to provide own proxy and network credentials separately.
 
Constructor Summary
NetworkSettings()
           
 
Method Summary
static String getAuthenticationUsername(URI u)
          Returns the username for Proxy Authentication.
static String getKeyForAuthenticationPassword(URI u)
          Returns the key for reading password for Proxy Authentication.
static String getProxyHost(URI u)
          Returns the hostname part of network proxy address based on given URI to access the resource at.
static String getProxyPort(URI u)
          Returns the port part of network proxy address based on given URI to access the resource at.
static boolean isAuthenticationDialogSuppressed()
          A utility method for implementations of Authenticator to suppress asking users a authentication question while running code posted in authenticationDialogSuppressed.
static
<R> R
suppressAuthenticationDialog(Callable<R> blockOfCode)
          Suppress asking user a question about the authentication credentials while running blockOfCode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NetworkSettings

public NetworkSettings()
Method Detail

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

getKeyForAuthenticationPassword

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()

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

org.openide.util 8.19.1

Built on December 7 2011.  |  Portions Copyright 1997-2011 Oracle. All rights reserved.