Class StandardHttpClient.StandardHttpClientBuilder
java.lang.Object
io.leandev.appfuse.http.StandardHttpClient.StandardHttpClientBuilder
- Enclosing class:
StandardHttpClient
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()停用 SSL 憑證驗證 ⚠️ 警告:僅用於開發和測試環境 ⚠️ 生產環境使用會有安全風險(容易受到中間人攻擊)usingGateway(URL gateway) withAuthenticator(Supplier<AccessToken> authenticator) withDefaultMaxPerRoute(int defaultMaxPerRoute) withInterceptor(HttpClientInterceptor interceptor) 新增自訂攔截器啟用預設日誌攔截器withLogging(HttpLogHandler logHandler) 啟用日誌攔截器(自訂配置)withLogging(HttpLogHandler logHandler, boolean includeRequestBody, boolean includeResponseBody, boolean includeStackTrace) 啟用日誌攔截器(完整配置)withMaxTotal(int maxTotal) withTimeout(int timeout)
-
Constructor Details
-
StandardHttpClientBuilder
public StandardHttpClientBuilder()
-
-
Method Details
-
build
-
withMaxTotal
-
withDefaultMaxPerRoute
-
withTimeout
-
withAuthenticator
public StandardHttpClient.StandardHttpClientBuilder withAuthenticator(Supplier<AccessToken> authenticator) -
usingGateway
-
disableSSLVerification
停用 SSL 憑證驗證 ⚠️ 警告:僅用於開發和測試環境 ⚠️ 生產環境使用會有安全風險(容易受到中間人攻擊) -
withInterceptor
public StandardHttpClient.StandardHttpClientBuilder withInterceptor(HttpClientInterceptor interceptor) 新增自訂攔截器- Parameters:
interceptor- 攔截器- Returns:
- Builder 實例
-
withLogging
啟用預設日誌攔截器
使用預設配置:
- 輸出到 Slf4j Logger
- 不包含請求/回應 Body
- 自動遮罩敏感資訊
- Returns:
- Builder 實例
-
withLogging
啟用日誌攔截器(自訂配置)- Parameters:
logHandler- 日誌處理器- Returns:
- Builder 實例
-
withLogging
public StandardHttpClient.StandardHttpClientBuilder withLogging(HttpLogHandler logHandler, boolean includeRequestBody, boolean includeResponseBody, boolean includeStackTrace) 啟用日誌攔截器(完整配置)- Parameters:
logHandler- 日誌處理器includeRequestBody- 是否包含請求 BodyincludeResponseBody- 是否包含回應 BodyincludeStackTrace- 是否包含 Stack Trace- Returns:
- Builder 實例
-