- java.lang.Object
-
- org.shredzone.acme4j.connector.NetworkSettings
-
public class NetworkSettings extends Object
Contains network settings to be used for network connections.- Since:
- 2.8
-
-
Field Summary
Fields Modifier and Type Field Description static String
GZIP_PROPERTY_NAME
Name of the system property to control GZIP compression.
-
Constructor Summary
Constructors Constructor Description NetworkSettings()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Authenticator
getAuthenticator()
Gets theAuthenticator
to be used, ornull
if none is to be set.ProxySelector
getProxySelector()
Gets theProxySelector
to be used for connections.Duration
getTimeout()
Gets the current network timeout.boolean
isCompressionEnabled()
Checks if HTTP compression is enabled.void
setAuthenticator(Authenticator authenticator)
Sets anAuthenticator
to be used if HTTP authentication is needed (e.g.void
setCompressionEnabled(boolean compression)
Sets if HTTP compression is enabled.void
setProxySelector(ProxySelector proxySelector)
Sets aProxySelector
that is to be used for all connections.void
setTimeout(Duration timeout)
Sets the network timeout to be used for connections.
-
-
-
Field Detail
-
GZIP_PROPERTY_NAME
public static final String GZIP_PROPERTY_NAME
Name of the system property to control GZIP compression. Expects a boolean value.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NetworkSettings
public NetworkSettings()
-
-
Method Detail
-
getProxySelector
public ProxySelector getProxySelector()
Gets theProxySelector
to be used for connections.- Since:
- 3.0.0
-
setProxySelector
public void setProxySelector(@Nullable ProxySelector proxySelector)
Sets aProxySelector
that is to be used for all connections. Ifnull
,HttpClient.Builder.NO_PROXY
is used, which is also the default.- Since:
- 3.0.0
-
getAuthenticator
@Nullable public Authenticator getAuthenticator()
Gets theAuthenticator
to be used, ornull
if none is to be set.- Since:
- 3.0.0
-
setAuthenticator
public void setAuthenticator(@Nullable Authenticator authenticator)
Sets anAuthenticator
to be used if HTTP authentication is needed (e.g. by a proxy).null
means that no authenticator shall be set.- Since:
- 3.0.0
-
getTimeout
public Duration getTimeout()
Gets the current network timeout.
-
setTimeout
public void setTimeout(Duration timeout)
Sets the network timeout to be used for connections. Defaults to 10 seconds.- Parameters:
timeout
- Network timeoutDuration
-
isCompressionEnabled
public boolean isCompressionEnabled()
Checks if HTTP compression is enabled.- Since:
- 3.0.0
-
setCompressionEnabled
public void setCompressionEnabled(boolean compression)
Sets if HTTP compression is enabled. It is enabled by default, but can be disabled e.g. for debugging purposes.acme4j gzip compression can also be controlled via the "org.shredzone.acme4j.gzip_compression" system property.
- Since:
- 3.0.0
-
-