public class OkRequests extends Object
Modifier and Type | Method and Description |
---|---|
static OkDownload |
download(String url)
同步下载文件
|
static OkDownload |
download(String url,
okhttp3.OkHttpClient client)
同步下载文件
|
static OkAsyncDownload |
downloadAsync(String url)
异步下载文件
|
static OkAsyncDownload |
downloadAsync(String url,
okhttp3.OkHttpClient client)
异步下载文件
|
static OkRequest |
get()
获取get请求
|
static OkResponse |
get(String url)
get
|
static OkResponse |
get(String url,
Map<String,?> params)
get
|
static okhttp3.OkHttpClient |
getClient() |
static OkWebSocketClient |
getWebSocketClient(String url)
获取webSocket client
|
static OkWebSocketServer |
getWebSocketServer(InetAddress address,
int port)
获取webSocket server
|
static OkWebSocketServer |
getWebSocketServer(int port)
获取webSocket server
|
static OkRequest |
post()
获取post请求
|
static OkResponse |
post(String url)
post
|
static OkResponse |
post(String url,
byte[] body)
post application/json
|
static OkResponse |
post(String url,
Map<String,String> formParts)
post x-www-form-urlencoded
|
static OkResponse |
post(String url,
String body)
post application/json
|
static OkResponse |
post(String url,
String contentType,
byte[] body)
post
|
static OkResponse |
post(String url,
String contentType,
String body)
post
|
static void |
setClient(okhttp3.OkHttpClient client) |
static OkUpload |
upload(String url)
同步上传文件
|
static OkUpload |
upload(String url,
okhttp3.OkHttpClient client)
同步上传文件
|
static OkAsyncUpload |
uploadAsync(String url)
异步上传文件
|
static OkAsyncUpload |
uploadAsync(String url,
okhttp3.OkHttpClient client)
异步上传文件
|
public static OkResponse get(String url)
url
- urlpublic static OkResponse get(String url, Map<String,?> params)
url
- urlparams
- paramspublic static OkResponse post(String url)
url
- urlpublic static OkResponse post(String url, byte[] body)
url
- urlbody
- bodypublic static OkResponse post(String url, String body)
url
- urlbody
- bodypublic static OkResponse post(String url, String contentType, byte[] body)
url
- urlcontentType
- contentTypebody
- bodypublic static OkResponse post(String url, String contentType, String body)
url
- urlcontentType
- contentTypebody
- bodypublic static OkResponse post(String url, Map<String,String> formParts)
url
- urlformParts
- formPartspublic static OkRequest get()
public static OkRequest post()
public static OkAsyncDownload downloadAsync(String url)
url
- urlpublic static OkAsyncDownload downloadAsync(String url, okhttp3.OkHttpClient client)
url
- urlclient
- clientpublic static OkDownload download(String url)
url
- urlpublic static OkDownload download(String url, okhttp3.OkHttpClient client)
url
- urlclient
- clientpublic static OkAsyncUpload uploadAsync(String url)
url
- urlpublic static OkAsyncUpload uploadAsync(String url, okhttp3.OkHttpClient client)
url
- urlclient
- clientpublic static OkUpload upload(String url, okhttp3.OkHttpClient client)
url
- urlclient
- clientpublic static OkWebSocketClient getWebSocketClient(String url)
url
- urlpublic static OkWebSocketServer getWebSocketServer(int port)
port
- portpublic static OkWebSocketServer getWebSocketServer(InetAddress address, int port)
address
- addressport
- portpublic static okhttp3.OkHttpClient getClient()
public static void setClient(okhttp3.OkHttpClient client)
Copyright © 2024. All rights reserved.