Package net.dreamlu.mica.http
Class HttpRequest
java.lang.Object
net.dreamlu.mica.http.HttpRequest
ok http 封装,请求结构体
- Author:
- L.cm
-
Method Summary
Modifier and TypeMethodDescriptionaddCookie(okhttp3.Cookie cookie) async()authenticator(okhttp3.Authenticator authenticator) body(byte[] body) body(byte[] body, okhttp3.MediaType contentType) body(okhttp3.RequestBody requestBody) bodyString(String body) bodyString(okhttp3.MediaType contentType, String body) cacheControl(okhttp3.CacheControl cacheControl) connectTimeout(Duration timeout) cookieManager(okhttp3.CookieJar cookieJar) static HttpRequeststatic HttpRequesteventListener(okhttp3.EventListener eventListener) execute()followRedirects(boolean followRedirects) followSslRedirects(boolean followSslRedirects) static HttpRequeststatic HttpRequeststatic Pair<SSLContext,X509TrustManager> getSslContext(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass) static Pair<SSLContext,X509TrustManager> getSslContext(String keyStoreFile, String keyPass, String trustStoreFile, String trustPass) hostnameVerifier(HostnameVerifier hostnameVerifier) interceptor(okhttp3.Interceptor interceptor) static HttpRequeststatic HttpRequeststatic HttpRequeststatic HttpRequestproxy(InetSocketAddress address) proxy(Proxy.Type type, InetSocketAddress address) proxyAuthenticator(okhttp3.Authenticator proxyAuthenticator) proxySelector(ProxySelector proxySelector) static HttpRequeststatic HttpRequestqueryEncoded(String encodedQuery) queryEncoded(String encodedName, @Nullable Object encodedValue) readTimeout(Duration readTimeout) removeHeader(String name) retry()retry(int maxAttempts, long sleepMillis) retry(int maxAttempts, long sleepMillis, Predicate<ResponseSpec> respPredicate) retry(IRetry retry, Predicate<ResponseSpec> respPredicate) retryOn(Predicate<ResponseSpec> respPredicate) static voidsetGlobalConsoleLog(LogLevel logLevel) 设置全局日志,控制台日志static voidsetGlobalDefaultLog(LogLevel logLevel) 设置全局日志,平台自带日志,默认 jdk 日志static void设置全局日志,默认级别:BODYstatic voidsetGlobalLog(HttpLoggingInterceptor.Logger logger, LogLevel logLevel) 设置全局日志static voidsetGlobalLog(LogLevel logLevel) 设置全局日志,默认:Slf4jstatic okhttp3.OkHttpClient设置全局的 ssl 配置static okhttp3.OkHttpClientsetGlobalSSL(InputStream keyStoreInputStream, String keyPass) static okhttp3.OkHttpClientsetGlobalSSL(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass) static okhttp3.OkHttpClientsetGlobalSSL(String keyStoreFile, String keyPass) static okhttp3.OkHttpClientsetGlobalSSL(String keyStoreFile, String keyPass, String trustStoreFile, String trustPass) static okhttp3.OkHttpClientsetGlobalSSL(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager) static voidsetHttpClient(okhttp3.OkHttpClient httpClient) sslSocketFactory(SSLSocketFactory sslSocketFactory, @Nullable X509TrustManager trustManager) toString()useConsoleLog(LogLevel logLevel) useDefaultLog(LogLevel logLevel) useLog(HttpLoggingInterceptor.Logger logger) useLog(HttpLoggingInterceptor.Logger logger, LogLevel logLevel) useSlf4jLog(LogLevel logLevel) useSSL()useSSL(InputStream keyStoreInputStream, String keyPass) useSSL(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass) useSSL(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager) writeTimeout(Duration writeTimeout)
-
Method Details
-
get
-
get
-
post
-
post
-
patch
-
patch
-
put
-
put
-
delete
-
delete
-
pathParam
-
query
-
queryEncoded
-
queryMap
-
query
-
queryEncoded
-
formBuilder
-
multipartFormBuilder
-
body
-
body
-
body
-
body
-
body
-
bodyString
-
bodyString
-
bodyJson
-
bodyJson
-
execute
-
async
-
executeAsync
-
executeAsyncAndJoin
-
baseAuth
-
addHeader
-
addHeader
-
addHeader
-
setHeader
-
removeHeader
-
addCookie
-
addCookie
-
cacheControl
-
userAgent
-
followRedirects
-
followSslRedirects
-
useSlf4jLog
-
useSlf4jLog
-
useConsoleLog
-
useConsoleLog
-
useDefaultLog
-
useDefaultLog
-
useLog
-
useLog
-
authenticator
-
eventListener
-
interceptor
-
cookieManager
-
connectTimeout
-
readTimeout
-
writeTimeout
-
protocols
-
proxy
-
proxy
-
proxy
-
proxy
-
proxySelector
-
proxyAuthenticator
-
retry
-
retryOn
-
retry
-
retry
-
retry
-
retry
-
hostnameVerifier
-
sslSocketFactory
public HttpRequest sslSocketFactory(SSLSocketFactory sslSocketFactory, @Nullable X509TrustManager trustManager) -
useSSL
-
useSSL
-
useSSL
-
useSSL
public HttpRequest useSSL(String keyStoreFile, String keyPass, String trustStoreFile, String trustPass) -
useSSL
-
useSSL
public HttpRequest useSSL(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass) -
toString
-
setHttpClient
public static void setHttpClient(okhttp3.OkHttpClient httpClient) -
setGlobalDefaultLog
设置全局日志,平台自带日志,默认 jdk 日志- Parameters:
logLevel- LogLevel
-
setGlobalConsoleLog
设置全局日志,控制台日志- Parameters:
logLevel- LogLevel
-
setGlobalLog
设置全局日志,默认级别:BODY- Parameters:
logger- HttpLoggingInterceptor.Logger
-
setGlobalLog
设置全局日志,默认:Slf4j- Parameters:
logLevel- LogLevel
-
setGlobalLog
设置全局日志- Parameters:
logger- HttpLoggingInterceptor.LoggerlogLevel- LogLevel
-
setGlobalSSL
public static okhttp3.OkHttpClient setGlobalSSL()设置全局的 ssl 配置 -
setGlobalSSL
-
setGlobalSSL
-
setGlobalSSL
-
setGlobalSSL
public static okhttp3.OkHttpClient setGlobalSSL(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass) -
setGlobalSSL
public static okhttp3.OkHttpClient setGlobalSSL(SSLSocketFactory sslSocketFactory, X509TrustManager trustManager) -
getSslContext
public static Pair<SSLContext,X509TrustManager> getSslContext(String keyStoreFile, String keyPass, String trustStoreFile, String trustPass) -
getSslContext
public static Pair<SSLContext,X509TrustManager> getSslContext(InputStream keyStoreInputStream, String keyPass, InputStream trustInputStream, String trustPass)
-