Class ProxyConfiguration
- All Implemented Interfaces:
Describable<ProxyConfiguration>
,Saveable
,Serializable
Use open(URL)
to open a connection with the proxy setting.
Proxy authentication (including NTLM) is implemented by setting a default
Authenticator
which provides a PasswordAuthentication
(as described in the Java 8 tech note
Http Authentication).
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal String
List of host names that shouldn't use proxy, as typed by users.final int
-
Constructor Summary
ConstructorDescriptionProxyConfiguration
(String name, int port) ProxyConfiguration
(String name, int port, String userName, String password) ProxyConfiguration
(String name, int port, String userName, String password, String noProxyHost) ProxyConfiguration
(String name, int port, String userName, String password, String noProxyHost, String testUrl) -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.createProxy
(String host) static Proxy
createProxy
(String host, String name, int port, String noProxyHost) Deprecated.static InputStream
getInputStream
(URL url) Deprecated.getName()
Returns the list of properly formatted no proxy host names.getNoProxyHostPatterns
(String noProxyHost) Returns the list of properly formatted no proxy host names.Deprecated.int
getPort()
static XmlFile
static ProxyConfiguration
load()
static HttpClient
Return a newHttpClient
with Jenkins-specific default settings.static HttpClient.Builder
Create a newHttpClient.Builder
preconfigured with Jenkins-specific default settings.static HttpRequest.Builder
newHttpRequestBuilder
(URI uri) Create a newHttpRequest.Builder
builder with the given URI preconfigured with Jenkins-specific default settings.static URLConnection
Deprecated.void
save()
Persists the state of this object into XML.void
setNoProxyHost
(String noProxyHost) void
setSecretPassword
(Secret secretPassword) void
setTestUrl
(String testUrl) void
setUserName
(String userName) Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
-
Field Details
-
name
-
port
public final int port -
noProxyHost
List of host names that shouldn't use proxy, as typed by users.- See Also:
-
-
Constructor Details
-
ProxyConfiguration
-
ProxyConfiguration
-
ProxyConfiguration
-
ProxyConfiguration
-
-
Method Details
-
getUserName
-
getSecretPassword
-
getPassword
Deprecated. -
getEncryptedPassword
Deprecated.- Returns:
- the encrypted proxy password
-
getTestUrl
-
getPort
public int getPort() -
getName
-
getNoProxyHostPatterns
Returns the list of properly formatted no proxy host names. -
getNoProxyHost
-
getNoProxyHostPatterns
Returns the list of properly formatted no proxy host names. -
setSecretPassword
-
setTestUrl
-
setUserName
-
setNoProxyHost
-
createProxy
Deprecated. -
createProxy
-
createProxy
-
save
Description copied from interface:Saveable
Persists the state of this object into XML.For making a bulk change efficiently, see
BulkChange
.To support listeners monitoring changes to this object, call
SaveableListener.fireOnChange(hudson.model.Saveable, hudson.XmlFile)
- Specified by:
save
in interfaceSaveable
- Throws:
IOException
- if the persistence failed.
-
getXmlFile
-
load
- Throws:
IOException
-
open
Deprecated.This method should be used whereverURL.openConnection()
to internet URLs is invoked directly.- Throws:
IOException
-
getInputStream
Deprecated.- Throws:
IOException
-
newHttpClient
Return a newHttpClient
with Jenkins-specific default settings.Equivalent to
newHttpClientBuilder().followRedirects(HttpClient.Redirect.NORMAL).build()
.- Returns:
- a new
HttpClient
- Since:
- 2.379
- See Also:
-
newHttpClientBuilder
Create a newHttpClient.Builder
preconfigured with Jenkins-specific default settings.The Jenkins-specific default settings include a proxy server and proxy authentication (as configured by
ProxyConfiguration
) and a connection timeout (as configured byDEFAULT_CONNECT_TIMEOUT_MILLIS
).Warning: if both
getName()
andgetUserName()
are set (meaning that an authenticated proxy is defined), you will not be able to pass anAuthorization
header to the real server when running on Java 17 and later (pending JDK-8326949.- Returns:
- an
HttpClient.Builder
- Since:
- 2.379
-
newHttpRequestBuilder
Create a newHttpRequest.Builder
builder with the given URI preconfigured with Jenkins-specific default settings.The Jenkins-specific default settings include a custom user agent on the controller (unless
UserAgentURLConnectionDecorator.DISABLED
is true).- Parameters:
uri
- the request URI- Returns:
- an
HttpRequest.Builder
- Throws:
IllegalArgumentException
- if the URI scheme is not supported- Since:
- 2.379
-
createProxy(String)