public class ProxyOptions extends ChangeEventSource implements Copyable
You can obtain the current settings using getProxyOptions()
. You can
replace the current proxy settings by instantiating a new instance of this
class and calling the static method setProxyOptions( ProxyOptions )
.
Typically this should be avoided and a ProxyOptionsFilter should be set
on the ProxyOptions instead.
While this class is not final, subclassing it is not supported, doing so may cause your extension to break in a future release of the product.
Modifier and Type | Class and Description |
---|---|
static class |
ProxyOptions.ProxyType |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_PROXY_PORT
The default proxy port.
|
static java.util.concurrent.locks.Lock |
doTaskLock
This class was originally designed to perform the doTask
synchronized on the ProxyOptions class; but this means that
any class that required access to the proxy options during this
operation, for example the HTTP Analyzer when dealing with outgoing
request cannot access the currrent proxy options.
|
static java.lang.String |
KEY_SETTINGS
The key for this settings object.
|
static java.lang.String |
PROPERTY_PROXY_EXCEPTIONS
The name of the Java system proprety that stores the proxy exceptions.
|
static java.lang.String |
PROPERTY_PROXY_HOST
The name of the Java system property that stores the proxy host.
|
static java.lang.String |
PROPERTY_PROXY_PORT
The name of the Java system property that stores the proxy port.
|
_hash
Modifier | Constructor and Description |
---|---|
|
ProxyOptions() |
protected |
ProxyOptions(HashStructure hash) |
Modifier and Type | Method and Description |
---|---|
void |
applyToCurrentVM()
Applies the options stored in this object to the Java VM in which the
IDE is running.
|
java.lang.Object |
copyTo(java.lang.Object target)
Copy support.
|
protected void |
copyToImpl(ProxyOptions copy) |
void |
doTask(java.lang.Runnable r)
Performs an operation, setting the VM proxy options temporarily to the
settings stored in this ProxyOptions object.
|
static java.lang.String |
ensureLocalExceptionsAdded(java.lang.String proxyExceptions)
Ensures that local exceptions are added to the passed in string
|
boolean |
equals(java.lang.Object other)
Equals support.
|
java.lang.String |
getAutoConfigScript()
Get whether proxy authentication should be used.
|
ProxyOptionsFilter |
getFilter()
Gets the filter applied to the ProxyOptions
This only should be used to get the filter for the IDE settings and the system default proxy settings,
other ProxyOptions objects will not use filters and a default filter will always be returned
|
static ProxyOptions |
getInstance(PropertyStorage prefs) |
boolean |
getIsIdeProxy()
Gets whether the ProxyOptions object is the one taht represents the IDE settings
|
java.lang.String[] |
getJavaProxyOptions()
Get proxy options as command line arguments suitable for passing into
java.exe.
|
java.lang.String |
getProxyData()
Get the encrypted password.
|
java.lang.String |
getProxyExceptions()
Get the list of proxy exceptions.
|
java.lang.String |
getProxyHost()
Get the name of the host to use as an http proxy.
|
static ProxyOptions |
getProxyOptions()
Get the current proxy options.
|
char[] |
getProxyPassword()
Get the password for proxy authentication.
|
java.lang.String |
getProxyPort()
Get the tcp port number of the proxy host.
|
ProxyOptions.ProxyType |
getProxyType() |
java.lang.String |
getProxyUserName()
Get the username for proxy authentication.
|
java.lang.String |
getUnfilteredAutoConfigScript()
Gets the use proxy authentication setting without applying any filter (should be used only be
preference panels)
|
java.lang.String |
getUnfilteredProxyData()
Gets the proxy data without applying any filter (should be used only be
preference panels)
|
java.lang.String |
getUnfilteredProxyExceptions()
Gets the proxy exceptions without applying any filter (should be used only be
preference panels)
|
java.lang.String |
getUnfilteredProxyHost()
Gets the proxy host without applying any filter (should be used only be
preference panels)
|
char[] |
getUnfilteredProxyPassword()
Gets the proxy password without applying any filter (should be used only be
preference panels)
|
java.lang.String |
getUnfilteredProxyPort()
Gets the proxy port without applying any filter (should be used only be
preference panels)
|
ProxyOptions.ProxyType |
getUnfilteredProxyType()
Returns the type of proxy specification, if any
|
java.lang.String |
getUnfilteredProxyUserName()
Gets the proxy user name without applying any filter (should be used only be
preference panels)
|
java.lang.Boolean |
getUnfilteredUseProxy()
Gets the use proxy setting without applying any filter (should be used only be
preference panels)
|
java.lang.Boolean |
getUnfilteredUseProxyAuthentication()
Gets the use proxy authentication setting without applying any filter (should be used only be
preference panels)
|
boolean |
getUnfilteredUseSystemProxy()
Deprecated.
Use getUnfilteredProxyType() and compare with ProxyType.SYSTEM_PROXY
|
java.lang.Boolean |
getUseProxy()
Get whether an http proxy should be used.
|
java.lang.Boolean |
getUseProxyAuthentication()
Get whether proxy authentication should be used.
|
java.lang.Boolean |
getUseSystemProxy()
Deprecated.
Use getProxyType() and compare with ProxyOptions.ProxyType.SYSTEM_PROXY
|
void |
setAutoConfigScript(java.lang.String newAutoConfigScript)
Set whether proxy authentication should be used.
|
void |
setFilter(ProxyOptionsFilter filter)
Sets the filter applied to the ProxyOptions.
|
void |
setProxyData(java.lang.String newData)
Set the encrypted password.
|
void |
setProxyExceptions(java.lang.String newProxyExceptions)
Set the list of proxy exceptions.
|
void |
setProxyHost(java.lang.String newProxyHost)
Set the name of the host to use as an http proxy.
|
static void |
setProxyOptions(ProxyOptions proxyOptions)
Set the current proxy options.
|
void |
setProxyPassword(char[] newProxyPassword)
Set the password for proxy authentication.
|
void |
setProxyPort(java.lang.String newProxyPort)
Set the tcp port number of the proxy host.
|
void |
setProxyType(ProxyOptions.ProxyType type) |
void |
setProxyUserName(java.lang.String newProxyUserName)
Set the username for proxy authentication.
|
void |
setUseProxy(java.lang.Boolean newUseProxy)
Deprecated.
Use setProxyType(ProxyOptions.ProxyTypes)
|
void |
setUseProxyAuthentication(java.lang.Boolean newUseProxyAuthentication)
Set whether proxy authentication should be used.
|
void |
setUseSystemProxy(java.lang.Boolean newUseSystemProxy)
Deprecated.
Use setProxyType(ProxyOptions.ProxyType.SYSTEM_PROXY)
|
static java.lang.String[] |
splitExceptionsIntoArray(java.lang.String exceptions)
Splits the passed-in exception string into an array of strings
using the vertical bar separator as the string delimiter
|
addChangeListener, fireChangeEvent, fireChangeEvent, removeChangeListener, setUseObjectEquals
addStructureChangeListener, containsKey, copyToImpl, equalsImpl, findOrCreate, forcedCopyTo, getHashStructure, removeStructureChangeListener, useObjectEquals
public static final java.lang.String KEY_SETTINGS
public static final java.lang.String PROPERTY_PROXY_HOST
public static final java.lang.String PROPERTY_PROXY_PORT
public static final java.lang.String PROPERTY_PROXY_EXCEPTIONS
public static final java.lang.String DEFAULT_PROXY_PORT
public static java.util.concurrent.locks.Lock doTaskLock
public ProxyOptions()
protected ProxyOptions(HashStructure hash)
public static ProxyOptions getInstance(PropertyStorage prefs)
public static final ProxyOptions getProxyOptions() throws TransientMarker
TransientMarker
public boolean getIsIdeProxy() throws TransientMarker
TransientMarker
@Deprecated public final boolean getUnfilteredUseSystemProxy()
public ProxyOptionsFilter getFilter()
public void setFilter(ProxyOptionsFilter filter)
filter
- the filter to apply to the ProxyOtpions. When null is
passed the default filter will be re-appliedpublic static java.lang.String[] splitExceptionsIntoArray(java.lang.String exceptions)
exceptions
- public static java.lang.String ensureLocalExceptionsAdded(java.lang.String proxyExceptions)
proxyExceptions
- the exception stringpublic static final void setProxyOptions(ProxyOptions proxyOptions) throws TransientMarker
proxyOptions
- the new proxy options.TransientMarker
public final void setProxyHost(java.lang.String newProxyHost)
newProxyHost
- the host to use as an http proxy.public final java.lang.String getProxyHost()
public final java.lang.String getUnfilteredProxyHost()
public final void setProxyPort(java.lang.String newProxyPort)
newProxyPort
- the tcp port number of the proxy host.public final java.lang.String getProxyPort()
public final java.lang.String getUnfilteredProxyPort()
public final void setProxyExceptions(java.lang.String newProxyExceptions)
newProxyExceptions
- host name patterns which should bypass the proxypublic final java.lang.String getProxyExceptions()
public final java.lang.String getUnfilteredProxyExceptions()
public final void setProxyType(ProxyOptions.ProxyType type)
public ProxyOptions.ProxyType getProxyType()
public ProxyOptions.ProxyType getUnfilteredProxyType()
@Deprecated public final void setUseProxy(java.lang.Boolean newUseProxy)
newUseProxy
- whether an http proxy should be used. Setting this to true is equivalent to
setProxyType(ProxyType.MANUAL_PROXY). Setting this to false is equivalent to
setProxyType(ProxyType.DIRECT_CONNECTION)public java.lang.Boolean getUseProxy()
@Deprecated public final void setUseSystemProxy(java.lang.Boolean newUseSystemProxy)
newUseSystemProxy
- whether the system proxy should be used.@Deprecated public java.lang.Boolean getUseSystemProxy()
public java.lang.Boolean getUnfilteredUseProxy()
public final void setUseProxyAuthentication(java.lang.Boolean newUseProxyAuthentication)
newUseProxyAuthentication
- whether proxy authentication should be usedpublic java.lang.Boolean getUseProxyAuthentication()
public java.lang.Boolean getUnfilteredUseProxyAuthentication()
public final void setProxyUserName(java.lang.String newProxyUserName)
newProxyUserName
- the username for proxy authenticationpublic final java.lang.String getProxyUserName()
public final java.lang.String getUnfilteredProxyUserName()
public final void setProxyPassword(char[] newProxyPassword)
newProxyPassword
- the password for proxy authenticationpublic final char[] getProxyPassword() throws TransientMarker
TransientMarker
public final char[] getUnfilteredProxyPassword() throws TransientMarker
TransientMarker
public final void setProxyData(java.lang.String newData)
newData
- the new encrypted passwordpublic final java.lang.String getProxyData()
public final java.lang.String getUnfilteredProxyData()
public final void setAutoConfigScript(java.lang.String newAutoConfigScript)
newAutoConfigScript
- PAC scriptpublic java.lang.String getAutoConfigScript()
public java.lang.String getUnfilteredAutoConfigScript()
public java.lang.String[] getJavaProxyOptions()
NOTE: proxy authentication is not included in these arguments, as it would not be secure to pass this in plain text over the command line. If the Java application being launched needs to make connections through a proxy that requires authentication, it will need to obtain the authentication information itself. For example, it might provide an implementation of the java.net.Authenticator interface.
public void doTask(java.lang.Runnable r)
The operation is specified using a Runnable
. During the lifecycle
of the Runnable.run()
method, the VM's proxy options will be set
to those specified in the provided ProxyOptions object.
Important: the runnable is executed with a global lock held on the proxy options object. It should therefore avoid blocking for a long period of time.
r
- a runnable to execute with the specified proxy settings. This
runnable will be executed synchronously (i.e. on the calling thread).public void applyToCurrentVM()
Extension developers should generally never call this method. It is
called automatically by the IDE when the user changes proxy options on the
Web Browser / Proxy page in preferences, or when proxy options are
programmatically changed via the setProxyOptions(ProxyOptions)
method.
public final boolean equals(java.lang.Object other)
HashStructureAdapter
HashStructureAdapter._hash
, this base equals implementation should be
sufficient and not need to be overridden.equals
in class HashStructureAdapter
public java.lang.Object copyTo(java.lang.Object target)
HashStructureAdapter
copyTo
in interface Copyable
copyTo
in class ChangeEventSource
target
- The target object to which the state of
this
object should be copied. If target
is null
, then the copyTo
method will
return a new instance of this
class.this
object was copied. If the target
was
non-null
, then the return value is the same as the
target
object that was passed in; otherwise, the
return value is a new instance of this
class.protected final void copyToImpl(ProxyOptions copy)