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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringList of host names that shouldn't use proxy, as typed by users.final int -
Constructor Summary
ConstructorsConstructorDescriptionProxyConfiguration(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 ProxycreateProxy(String host, String name, int port, String noProxyHost) Deprecated.static InputStreamgetInputStream(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.intgetPort()static XmlFilestatic ProxyConfigurationload()static HttpClientReturn a newHttpClientwith Jenkins-specific default settings.static HttpClient.BuilderCreate a newHttpClient.Builderpreconfigured with Jenkins-specific default settings.static HttpRequest.BuildernewHttpRequestBuilder(URI uri) Create a newHttpRequest.Builderbuilder with the given URI preconfigured with Jenkins-specific default settings.static URLConnectionDeprecated.voidsave()Persists the state of this object into XML.voidsetNoProxyHost(String noProxyHost) voidsetSecretPassword(Secret secretPassword) voidsetTestUrl(String testUrl) voidsetUserName(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:SaveablePersists 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:
savein 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 newHttpClientwith 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.Builderpreconfigured 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 anAuthorizationheader 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.Builderbuilder 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.DISABLEDis true).- Parameters:
uri- the request URI- Returns:
- an
HttpRequest.Builder - Throws:
IllegalArgumentException- if the URI scheme is not supported- Since:
- 2.379
-
createProxy(String)