Class HttpClientConfig

java.lang.Object
org.summerboot.jexpress.boot.config.BootConfig
org.summerboot.jexpress.integration.httpclient.HttpClientConfig
All Implemented Interfaces:
JExpressConfig

public abstract class HttpClientConfig extends BootConfig
Author:
Changski Tie Zheng Zhang 张铁铮, 魏泽北, 杜旺财, 杜富贵
  • Field Details

    • FILENAME_KEYSTORE

      protected static final String FILENAME_KEYSTORE
      See Also:
    • FILENAME_TRUSTSTORE_4CLIENT

      protected static final String FILENAME_TRUSTSTORE_4CLIENT
      See Also:
    • protocol

      @ConfigHeader(title="1. HTTP Client Security") @Config(key="httpclient.ssl.protocol") protected volatile String protocol
    • KEY_kmf_key

      protected static final String KEY_kmf_key
      See Also:
    • KEY_kmf_StorePwdKey

      protected static final String KEY_kmf_StorePwdKey
      See Also:
    • KEY_kmf_AliasKey

      protected static final String KEY_kmf_AliasKey
      See Also:
    • KEY_kmf_AliasPwdKey

      protected static final String 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

      protected static final String KEY_tmf_key
      See Also:
    • KEY_tmf_StorePwdKey

      protected static final String 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

      @Config(key="httpclient.proxy.host") protected volatile String proxyHost
    • proxyPort

      @Config(key="httpclient.proxy.port") protected volatile int proxyPort
    • proxyUserName

      @Config(key="httpclient.proxy.userName") protected volatile String proxyUserName
    • proxyUserPwd

      @Config(key="httpclient.proxy.userPwd", validate=Encrypted) protected volatile String proxyUserPwd
    • proxyAuthorizationBasicValue

      protected volatile String proxyAuthorizationBasicValue
    • redirectOption

      @Config(key="httpclient.redirectOption") protected volatile HttpClient.Redirect redirectOption
    • fromJsonCaseInsensitive

      @Config(key="httpclient.fromJson.CaseInsensitive") protected volatile boolean fromJsonCaseInsensitive
    • fromJsonFailOnUnknownProperties

      @Config(key="httpclient.fromJson.failOnUnknownProperties") protected volatile boolean 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

      @ConfigHeader(title="2. HTTP Client Performance") protected volatile HttpClient httpClient
    • builder

      protected volatile HttpClient.Builder builder
    • httpConnectTimeoutMs

      @Config(key="httpclient.timeout.connect.ms", desc="The maximum time to wait for only the connection to be established, should be less than httpclient.timeout.ms") protected volatile long httpConnectTimeoutMs
    • httpClientTimeoutMs

      @Config(key="httpclient.timeout.ms", desc="The maximum time to wait from the beginning of the connection establishment until the server sends data back, this is the end-to-end timeout.") protected volatile long httpClientTimeoutMs
    • 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

      protected ThreadPoolExecutor tpe
    • ses

      protected ScheduledExecutorService ses
    • HEADER_CLIENT_REQUEST

      protected static final String 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

      protected HTTPClientStatusListener listener
  • Constructor Details

    • HttpClientConfig

      protected HttpClientConfig()
  • Method Details

    • main

      public static void main(String[] args)
    • shutdown

      public void shutdown()
    • generateTemplate_keystore

      protected void generateTemplate_keystore(StringBuilder sb)
    • generateTemplate_truststore

      protected void generateTemplate_truststore(StringBuilder sb)
    • generateTemplate_RequestHeaders

      protected void generateTemplate_RequestHeaders(StringBuilder sb)
    • setStatusListener

      public void setStatusListener(HTTPClientStatusListener l)
    • preLoad

      protected void preLoad(File cfgFile, boolean isReal, ConfigUtil helper, Properties props)
      Overrides:
      preLoad in class BootConfig
    • loadCustomizedConfigs

      protected void loadCustomizedConfigs(File cfgFile, boolean isReal, ConfigUtil helper, Properties props) throws Exception
      Specified by:
      loadCustomizedConfigs in class BootConfig
      Throws:
      Exception
    • getHttpClient

      public HttpClient getHttpClient()
    • getBuilder

      public HttpClient.Builder getBuilder()
    • updateBuilder

      public HttpClient updateBuilder(HttpClient.Builder builder)
    • getHttpClientDefaultRequestHeaders

      public Map<String,String> getHttpClientDefaultRequestHeaders()
    • getProtocol

      public String getProtocol()
    • isHostnameVerificationEnabled

      public Boolean isHostnameVerificationEnabled()
    • getProxyHost

      public String getProxyHost()
    • getProxyPort

      public int getProxyPort()
    • getProxyUserName

      public String getProxyUserName()
    • getProxyUserPwd

      public String getProxyUserPwd()
    • getProxyAuthorizationBasicValue

      public String getProxyAuthorizationBasicValue()
    • isFromJsonCaseInsensitive

      public boolean isFromJsonCaseInsensitive()
    • isFromJsonFailOnUnknownProperties

      public boolean isFromJsonFailOnUnknownProperties()
    • getJsonParserTimeZone

      public TimeZone getJsonParserTimeZone()
    • getHttpConnectTimeoutMs

      public long getHttpConnectTimeoutMs()
    • getHttpClientTimeoutMs

      public long getHttpClientTimeoutMs()
    • getHttpClientCoreSize

      public int getHttpClientCoreSize()
    • getHttpClientMaxSize

      public int getHttpClientMaxSize()
    • getHttpClientQueueSize

      public int getHttpClientQueueSize()
    • getHttpClientInfo

      public String getHttpClientInfo()
    • getTpeInfo

      public String getTpeInfo()