Class HttpClientConfig
java.lang.Object
org.summerboot.jexpress.boot.config.BootConfig
org.summerboot.jexpress.integration.httpclient.HttpClientConfig
- All Implemented Interfaces:
JExpressConfig
- Author:
- Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
-
Nested Class Summary
Nested classes/interfaces inherited from class org.summerboot.jexpress.boot.config.BootConfig
BootConfig.ThreadingMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected HttpClient.Builderprotected static final Stringprotected static final Stringprotected booleanprotected booleanprotected static final Stringprotected Booleanprotected HttpClientprotected intprotected intprotected intprotected longprotected longprotected TimeZoneprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected KeyManagerFactoryprotected HTTPClientStatusListenerprotected booleanprotected Stringprotected Stringprotected Stringprotected intprotected Stringprotected Stringprotected HttpClient.Redirectprotected ScheduledExecutorServiceprotected TrustManagerFactoryprotected ThreadPoolExecutorprotected intprotected BootConfig.ThreadingModeFields inherited from class org.summerboot.jexpress.boot.config.BootConfig
BR, cache, cfgFile, configName, CPU_CORE, DESC_KMF, DESC_PLAINPWD, DESC_TMF, FILENAME_SRC_TRUSTSTORE, generateTemplate, logger, props -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected voidintintintlonglongintbooleanbooleanprotected voidloadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) static voidprotected voidpreLoad(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) voidvoidshutdown()updateBuilder(HttpClient.Builder builder) Methods inherited from class org.summerboot.jexpress.boot.config.BootConfig
buildThreadPoolExecutor, buildThreadPoolExecutor, buildThreadPoolExecutor, createIfNotExist, generateTemplate, getCfgFile, getLength, getProperties, info, instance, lineBreak, load, loadField, name, parse, registerSingleton, temp, updateConfigFile, updateFilePath
-
Field Details
-
FILENAME_KEYSTORE
- See Also:
-
FILENAME_TRUSTSTORE_4CLIENT
- See Also:
-
protocol
@ConfigHeader(title="1. HTTP Client Security") @Config(key="httpclient.ssl.protocol") protected volatile String protocol -
KEY_kmf_key
- See Also:
-
KEY_kmf_StorePwdKey
- See Also:
-
KEY_kmf_AliasKey
- See Also:
-
KEY_kmf_AliasPwdKey
- See Also:
-
kmf
@Config(key="httpclient.ssl.KeyStore", StorePwdKey="httpclient.ssl.KeyStorePwd", AliasKey="httpclient.ssl.KeyAlias", AliasPwdKey="httpclient.ssl.KeyPwd", desc="Path to key store file. Use SSL/TLS when keystore is provided, otherwise use plain socket", callbackMethodName4Dump="generateTemplate_keystore") protected volatile KeyManagerFactory kmf -
KEY_tmf_key
- See Also:
-
KEY_tmf_StorePwdKey
- See Also:
-
tmf
@Config(key="httpclient.ssl.TrustStore", StorePwdKey="httpclient.ssl.TrustStorePwd", callbackMethodName4Dump="generateTemplate_truststore", desc="Path to trust store file. Auth the remote peer certificate when a truststore is provided, otherwise blindly trust all remote peer certificate") protected volatile TrustManagerFactory tmf -
hostnameVerification
@Config(key="httpclient.ssl.HostnameVerification", defaultValue="true") protected volatile Boolean hostnameVerification -
proxyHost
-
proxyPort
-
proxyUserName
-
proxyUserPwd
-
proxyAuthorizationBasicValue
-
redirectOption
-
fromJsonCaseInsensitive
-
fromJsonFailOnUnknownProperties
-
jsonParserTimeZone
@Config(key="httpclient.fromJson.TimeZone", desc="The ID for a TimeZone, either an abbreviation such as \"UTC\", a full name such as \"America/Toronto\", or a custom ID such as \"GMT-8:00\", or \"system\" as system default timezone.", defaultValue="system") protected TimeZone jsonParserTimeZone -
httpClient
-
builder
-
httpConnectTimeoutMs
-
httpClientTimeoutMs
-
tpeThreadingMode
@Config(key="httpclient.executor.mode", defaultValue="VirtualThread", desc="valid value = VirtualThread (default for Java 21+), CPU, IO and Mixed (default for old Java) \n use CPU core + 1 when application is CPU bound\nuse CPU core x 2 + 1 when application is I/O bound\nneed to find the best value based on your performance test result when nio.server.BizExecutor.mode=Mixed") protected volatile BootConfig.ThreadingMode tpeThreadingMode -
httpClientCoreSize
@Config(key="httpclient.executor.CoreSize", predefinedValue="0", desc="CoreSize 0 = current computer/VM\'s available processors x 2 + 1") protected volatile int httpClientCoreSize -
httpClientMaxSize
@Config(key="httpclient.executor.MaxSize", predefinedValue="0", desc="MaxSize 0 = current computer/VM\'s available processors x 2 + 1") protected volatile int httpClientMaxSize -
httpClientQueueSize
@Config(key="httpclient.executor.QueueSize", defaultValue="2147483647", desc="The waiting list size when the pool is full") protected volatile int httpClientQueueSize -
tpeKeepAliveSeconds
@Config(key="httpclient.executor.KeepAliveSec", defaultValue="60") protected volatile int tpeKeepAliveSeconds -
prestartAllCoreThreads
@Config(key="httpclient.executor.prestartAllCoreThreads", defaultValue="false") protected boolean prestartAllCoreThreads -
allowCoreThreadTimeOut
@Config(key="httpclient.executor.allowCoreThreadTimeOut", defaultValue="false") protected boolean allowCoreThreadTimeOut -
tpe
-
ses
-
HEADER_CLIENT_REQUEST
- See Also:
-
httpClientDefaultRequestHeaders
@ConfigHeader(title="3. HTTP Client Default Headers", desc="put generic HTTP Client request headers here", format="httpclient.DefaultReqHttpHeaders.<request_header_name>=<request_header_value>", example="httpclient.DefaultReqHttpHeaders.Accept=application/json\nhttpclient.DefaultReqHttpHeaders.Content-Type=application/json;charset=UTF-8\nhttpclient.DefaultReqHttpHeaders.Accept-Language=en-ca", callbackMethodName4Dump="generateTemplate_RequestHeaders") protected final Map<String,String> httpClientDefaultRequestHeaders -
listener
-
-
Constructor Details
-
HttpClientConfig
protected HttpClientConfig()
-
-
Method Details
-
main
-
shutdown
public void shutdown() -
generateTemplate_keystore
-
generateTemplate_truststore
-
generateTemplate_RequestHeaders
-
setStatusListener
-
preLoad
- Overrides:
preLoadin classBootConfig
-
loadCustomizedConfigs
protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) throws Exception - Specified by:
loadCustomizedConfigsin classBootConfig- Throws:
Exception
-
getHttpClient
-
getBuilder
-
updateBuilder
-
getHttpClientDefaultRequestHeaders
-
getProtocol
-
isHostnameVerificationEnabled
-
getProxyHost
-
getProxyPort
public int getProxyPort() -
getProxyUserName
-
getProxyUserPwd
-
getProxyAuthorizationBasicValue
-
isFromJsonCaseInsensitive
public boolean isFromJsonCaseInsensitive() -
isFromJsonFailOnUnknownProperties
public boolean isFromJsonFailOnUnknownProperties() -
getJsonParserTimeZone
-
getHttpConnectTimeoutMs
public long getHttpConnectTimeoutMs() -
getHttpClientTimeoutMs
public long getHttpClientTimeoutMs() -
getHttpClientCoreSize
public int getHttpClientCoreSize() -
getHttpClientMaxSize
public int getHttpClientMaxSize() -
getHttpClientQueueSize
public int getHttpClientQueueSize() -
getHttpClientInfo
-
getTpeInfo
-