public class OpenHttp extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static okhttp3.MediaType |
JSON |
| 构造器和说明 |
|---|
OpenHttp() |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
get(String url,
Map<String,String> header)
get请求
|
protected void |
initHttpClient() |
String |
postFile(String url,
Map<String,Object> form,
Map<String,String> header,
List<UploadFile> files)
提交表单,并且上传文件
|
String |
postJsonBody(String url,
String json,
Map<String,String> header)
提交json字符串到请求体
|
void |
setCookieStore(Map<String,List<okhttp3.Cookie>> cookieStore) |
void |
setHttpClient(okhttp3.OkHttpClient httpClient) |
protected void initHttpClient()
public String get(String url, Map<String,String> header) throws IOException
url - header - IOExceptionpublic String postJsonBody(String url, String json, Map<String,String> header) throws IOException
url - json - header - header内容IOExceptionpublic String postFile(String url, Map<String,Object> form, Map<String,String> header, List<UploadFile> files) throws IOException
url - form - header - files - IOExceptionpublic void setHttpClient(okhttp3.OkHttpClient httpClient)
Copyright © 2021. All Rights Reserved.