public class NetworkHandler extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static class |
NetworkHandler.RequestType |
| 限定符和类型 | 字段和说明 |
|---|---|
static okhttp3.MediaType |
JSON
Used to indicate this http-request accepts JSON
|
static okhttp3.MediaType |
TEXT
Used to indicate this http-request accepts normal String
|
| 构造器和说明 |
|---|
NetworkHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
HttpResponse |
get(String url,
Map<String,Object> data,
Map<String,String> header)
Send a GET http-request
|
HttpResponse |
post(String url,
Map<String,Object> data,
Map<String,String> header,
okhttp3.MediaType mediaType)
Send a POST http-request
|
HttpResponse |
put(String url,
Map<String,Object> data,
Map<String,String> header,
okhttp3.MediaType mediaType)
Send a PUT http-request
|
HttpResponse |
request(String url,
Map<String,Object> data,
Map<String,String> header,
okhttp3.MediaType mediaType,
NetworkHandler.RequestType requestType)
Send a http-request
|
HttpResponse |
request(String url,
Map<String,Object> data,
NetworkHandler.RequestType requestType)
Send a http-request
|
HttpResponse |
request(String url,
NetworkHandler.RequestType requestType)
Send a http-request
|
public static final okhttp3.MediaType JSON
public static final okhttp3.MediaType TEXT
public HttpResponse request(String url, Map<String,Object> data, NetworkHandler.RequestType requestType)
url - the request urldata - the request datarequestType - the request typepublic HttpResponse request(String url, NetworkHandler.RequestType requestType)
url - the request urlrequestType - the request typerequest(String, Map, RequestType)public HttpResponse request(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType, NetworkHandler.RequestType requestType)
url - the request urldata - the request dataheader - the request headermediaType - the request acceptable typerequestType - the request typepublic HttpResponse put(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType)
url - the request urldata - the request dataheader - the request headermediaType - the request acceptable typepublic HttpResponse post(String url, Map<String,Object> data, Map<String,String> header, okhttp3.MediaType mediaType)
url - the request urldata - the request dataheader - the request headermediaType - the request acceptable typeCopyright © 2022. All rights reserved.