public class HttperOld extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
bodyStr |
protected Charset |
charset |
protected int |
connectTimeout |
protected String |
contentType |
protected Map<String,Object> |
cookies |
protected boolean |
debug |
protected BiConsumer<Throwable,HttperOld> |
exHandler
异常处理
|
protected Map<String,Map<String,Object>> |
fileStreams |
protected Map<String,String> |
headers |
protected static org.slf4j.Logger |
log |
protected String |
method |
protected Map<String,Object> |
params |
protected Consumer<HttpURLConnection> |
preFn |
protected int |
readTimeout |
protected int |
respCode |
protected String |
result |
protected String |
tlsVersion |
protected String |
urlStr |
| 构造器和说明 |
|---|
HttperOld() |
| 限定符和类型 | 方法和说明 |
|---|---|
HttperOld |
charset(String charset) |
HttperOld |
connectTimeout(int timeout) |
HttperOld |
contentType(String contentType)
设置 content-type
|
HttperOld |
cookie(String name,
Object value) |
Map<String,Object> |
cookies() |
HttperOld |
debug() |
HttperOld |
delete(String url) |
String |
execute()
执行 http 请求
|
HttperOld |
exHandler(BiConsumer<Throwable,HttperOld> exHandler) |
HttperOld |
fileStream(String pName,
String filename,
InputStream fileStream)
添加文件流
|
HttperOld |
get(String url) |
int |
getResponseCode() |
HttperOld |
header(String name,
String value) |
HttperOld |
jsonBody(String jsonStr) |
HttperOld |
param(String name,
Object value)
添加参数
|
HttperOld |
post(String url) |
HttperOld |
preConnect(Consumer<HttpURLConnection> preConnect) |
HttperOld |
put(String url) |
HttperOld |
readTimeout(int timeout) |
HttperOld |
textBody(String bodyStr) |
HttperOld |
tlsVersion(String tlsVersion) |
protected static final org.slf4j.Logger log
protected String urlStr
protected String contentType
protected String method
protected String bodyStr
protected int connectTimeout
protected int readTimeout
protected int respCode
protected Consumer<HttpURLConnection> preFn
protected boolean debug
protected String tlsVersion
protected Charset charset
protected BiConsumer<Throwable,HttperOld> exHandler
protected String result
public HttperOld contentType(String contentType)
contentType - application/json, multipart/form-data, application/x-www-form-urlencoded, text/plainpublic HttperOld readTimeout(int timeout)
public HttperOld connectTimeout(int timeout)
public HttperOld preConnect(Consumer<HttpURLConnection> preConnect)
public HttperOld debug()
public HttperOld exHandler(BiConsumer<Throwable,HttperOld> exHandler)
public HttperOld fileStream(String pName, String filename, InputStream fileStream)
pName - 属性名filename - 文件名fileStream - 文件流public int getResponseCode()
public String execute()
Copyright © 2024. All rights reserved.