public final class NetworkSettings extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NetworkSettings.ProxyCredentialsProvider
Allows
NetBeans Platform users to provide own proxy and network credentials separately.
|
Constructor and Description |
---|
NetworkSettings() |
Modifier and Type | Method and Description |
---|---|
static char[] |
getAuthenticationPassword(URI u)
Returns the
password for Proxy Authentication. |
static String |
getAuthenticationUsername(URI u)
Returns the
username for Proxy Authentication. |
static String |
getKeyForAuthenticationPassword(URI u)
Deprecated.
|
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 NetworkSettings.authenticationDialogSuppressed . |
static <R> R |
suppressAuthenticationDialog(Callable<R> blockOfCode)
Suppress asking user a question about the authentication credentials while
running
blockOfCode . |
public static String getProxyHost(URI u)
hostname
part of network proxy address
based on given URI to access the resource at.
Returns null
for direct connection.u
- The URI that a connection is required tonull
public static String getProxyPort(URI u)
port
part of network proxy address
based on given URI to access the resource at.
Returns null
for direct connection.u
- The URI that a connection is required tonull
public static String getAuthenticationUsername(URI u)
username
for Proxy Authentication.
Returns null
if no authentication required.u
- The URI that a connection is required tonull
public static char[] getAuthenticationPassword(URI u)
password
for Proxy Authentication.
Returns null
if no authentication required.u
- The URI that a connection is required to@Deprecated public static String getKeyForAuthenticationPassword(URI u)
NetworkSettings.getAuthenticationPassword(java.net.URI)
insteadkey
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.u
- The URI that a connection is required tonull
public static <R> R suppressAuthenticationDialog(Callable<R> blockOfCode) throws Exception
blockOfCode
. It's a contract with NetBeans implementation
of Authenticator
.
In case a system is using other Authenticator implementation, it must call NetworkSettings.isAuthenticationDialogSuppressed()
method.blockOfCode
- Callable
containing code which will be executed while authentication is suppressedblockOfCode
and may throw an exception.Exception
NetworkSettings.isAuthenticationDialogSuppressed()
public static boolean isAuthenticationDialogSuppressed()
Authenticator
to suppress asking users a authentication question while running code posted
in NetworkSettings.authenticationDialogSuppressed
.NetworkSettings.authenticationDialogSuppressed
method.NetworkSettings.authenticationDialogSuppressed