Package com.helger.smpclient.config
Class SMPClientConfiguration
java.lang.Object
com.helger.smpclient.config.SMPClientConfiguration
This class manages the configuration properties of the SMP client. The order
of the properties file resolving is as follows:
- Check for the value of the system property
peppol.smp.client.properties.path - Check for the value of the system property
smp.client.properties.path - The filename
private-smp-client.propertiesin the root of the classpath - The filename
smp-client.propertiesin the root of the classpath
Note: this class is also licensed under Apache 2 license, as it was not part of the original implementation
- Author:
- Philip Helger
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.helger.config.source.MultiConfigurationValueProviderstatic com.helger.config.fallback.IConfigWithFallbackstatic org.apache.hc.core5.util.TimeoutGet the content of the property "http.connect.timeout.ms" or the default value.static org.apache.hc.core5.http.HttpHoststatic org.apache.hc.client5.http.auth.UsernamePasswordCredentialsstatic Stringstatic org.apache.hc.core5.util.TimeoutGet the content of the property "http.response.timeout.ms" or the default value.static char[]static Stringstatic com.helger.security.keystore.EKeyStoreTypestatic booleanGet the content of the property "http.useDNSClientCache" ortrueif undefined.static KeyStoreTry to load the configured trust store.static com.helger.config.fallback.IConfigWithFallbacksetConfig(com.helger.config.fallback.IConfigWithFallback aNewConfig) Overwrite the global configuration.
-
Method Details
-
createSMPClientValueProvider
@Nonnull public static com.helger.config.source.MultiConfigurationValueProvider createSMPClientValueProvider()- Returns:
- The configuration value provider for SMP client that contains backward compatibility support.
-
getConfig
- Returns:
- The current global configuration. Never
null.
-
setConfig
@Nonnull public static com.helger.config.fallback.IConfigWithFallback setConfig(@Nonnull com.helger.config.fallback.IConfigWithFallback aNewConfig) Overwrite the global configuration. This is only needed for testing.- Parameters:
aNewConfig- The configuration to use globally. May not benull.- Returns:
- The old value of
IConfig. Nevernull.
-
getTrustStoreType
- Returns:
- The truststore type as specified in the configuration file by the
key
truststore.type. If none is presentPeppolKeyStoreHelper.TRUSTSTORE_TYPEis returned as a default. - Since:
- 6.0.0
-
getTrustStorePath
- Returns:
- The truststore location as specified in the configuration file by
the key
truststore.path. If none is presentPeppolKeyStoreHelper.TRUSTSTORE_COMPLETE_CLASSPATHis returned as a default. Note: for backwards compatibility, also the keytruststore.locationis evaluated. - Since:
- 6.0.0 - was getTruststoreLocation before
-
getTrustStorePasswordCharArray
- Returns:
- The truststore password as specified in the configuration file by
the key
truststore.password. If none is presentPeppolKeyStoreHelper.TRUSTSTORE_PASSWORDis returned as a default.
-
loadTrustStore
Try to load the configured trust store.- Returns:
nullif it cannot be loaded.- Since:
- 8.1.1
-
getHttpProxy
- Returns:
- The HttpProxy object to be used by SMP clients based on the Java System properties "http.proxyHost" and "http.proxyPort". Note: https is not needed, because SMPs must run on http only.
-
getHttpProxyCredentials
@Nullable public static org.apache.hc.client5.http.auth.UsernamePasswordCredentials getHttpProxyCredentials()- Returns:
- The
UsernamePasswordCredentialsobject to be used for proxy server authentication. - Since:
- 5.2.5
-
getNonProxyHosts
- Returns:
- A pipe separated list of non-proxy hosts. E.g.
localhost|127.0.0.1. May benull. - Since:
- 6.2.4
-
isUseDNSClientCache
public static boolean isUseDNSClientCache()Get the content of the property "http.useDNSClientCache" ortrueif undefined.- Returns:
trueif the SMP client should use DNS client caching (default) orfalseif DNS caching should be disabled. The default behavior is to returntrue.- Since:
- 5.2.5
-
getConnectTimeout
Get the content of the property "http.connect.timeout.ms" or the default value.- Returns:
- The connection timeout of the SMP client. Defaults to 5 seconds.
- Since:
- 8.8.0
-
getResponseTimeout
Get the content of the property "http.response.timeout.ms" or the default value. The fallback value is "http.request.timeout.ms".- Returns:
- The response timeout of the SMP client. Defaults to 10 seconds.
- Since:
- 8.8.0
-