public class HttpConnetcionEX extends Object implements Serializable
┌─┐ ┌─┐
┌──┘ ┴───────┘ ┴──┐
│ │
│ ─── │
│ ─┬┘ └┬─ │
│ │
│ ─┴─ │
│ │
└───┐ ┌───┘
│ │
│ │
│ │
│ └──────────────┐
│ │
│ ├─┐
│ author:lelouch ┌─┘
│ │
└─┐ ┐ ┌───────┬──┐ ┌──┘
│ ─┤ ─┤ │ ─┤ ─┤
└──┴──┘ └──┴──┘
神兽保佑
代码无BUG!
| 限定符和类型 | 类和说明 |
|---|---|
static class |
HttpConnetcionEX.RequestProperty
User-Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.91 Safari/537.36
|
static class |
HttpConnetcionEX.ResponseX
结果
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected int |
connectTimeout
The Connect timeout.
|
protected String |
contentCharset
The Content charset.
|
protected Map<String,List<String>> |
headerFields
The Header fields.
|
protected HttpConnetcionListenEvent |
httpConnetcionListenEvent
The Http connetcion listen event.
|
static String |
LINEND
The constant PREFIX.
|
static String |
MULTIPART_FROM_DATA
The constant MULTIPART_FROM_DATA.
|
protected boolean |
needResult
是否需要结果,不需要时返回 ResponseCode
|
protected String |
post
The Post.
|
static String |
PREFIX
The constant PREFIX.
|
protected int |
readTimeout
The Read timeout.
|
Map<String,String> |
requestHeaders
The Header fields.
|
protected int |
requestMethod
The Request method.
|
protected Map<String,String> |
requestProperty
The Request property.
|
protected int |
retry_time
The Retry time.
|
protected boolean |
testssl
测试HTTPS 。
|
protected String |
url
The Url.
|
protected String |
url_302
The Url 302.
|
protected String |
userAgent
The User agent.
|
| 构造器和说明 |
|---|
HttpConnetcionEX(String url)
Instantiates a new Http connetcion ex.
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addRequestHeaders(String key,
String value) |
HttpConnetcionEX |
deepCopt()
Deep copt object.
|
String |
getCookie()
Gets cookie.
|
File |
getDownloadFile()
Gets download file.
|
Map<String,List<String>> |
getHeaderFields()
Gets header fields.
|
HttpConnetcionListenEvent |
getHttpConnetcionListenEvent()
Gets http connetcion listen event.
|
HTTPMethod |
getHttpMethod()
Gets http method.
|
long |
getLimitSpeed()
Gets limit speed.
|
ParamType |
getParamType()
Gets param type.
|
Map<String,String> |
getRequestHeaders() |
Map<String,String> |
getRequestProperty()
Gets request property.
|
String |
getResponseCookie()
Gets response cookie.
|
String |
getResponseCookie(Map<String,List<String>> headerFields)
Gets response cookie.
|
ResutlType |
getResutlType()
Gets resutl type.
|
String |
getUUID()
Gets uuid.
|
boolean |
isNeedResult()
Is need result boolean.
|
boolean |
isPrint_error()
Is print error boolean.
|
boolean |
isPrint_requestParams()
Is print request params boolean.
|
boolean |
isShowBody()
Is show body boolean.
|
boolean |
isTestssl()
Is testssl boolean.
|
protected void |
onException(Exception e)
异常
|
protected void |
onResponseCodeException(int code)
ResponseCode 不等于200
|
HttpConnetcionEX.ResponseX |
request()
请求 (GET)
|
HttpConnetcionEX.ResponseX |
request(Map<String,Object> params)
请求 (POST)
|
HttpConnetcionEX.ResponseX |
request(String Body)
请求 (POST)
|
void |
setConnectTimeout(int connectTimeout)
Sets connect timeout.
|
void |
setContentCharset(String contentCharset)
Sets content charset.
|
void |
setCookie(String Cookie)
Sets cookie.
|
void |
setDownloadFile(File downloadFile)
Sets download file.
|
void |
setHttpConnetcionListenEvent(HttpConnetcionListenEvent httpConnetcionListenEvent)
Sets http connetcion listen event.
|
void |
setHttpMethod(HTTPMethod httpMethod)
Sets http method.
|
void |
setLimitSpeed(long limitSpeed)
Sets limit speed.
|
void |
setNeedResult(boolean needResult)
Sets need result.
|
void |
setParamType(ParamType paramType)
Sets param type.
|
void |
setPrint_error(boolean print_error)
Sets print error.
|
void |
setPrint_requestParams(boolean print_requestParams)
Sets print request params.
|
void |
setReadTimeout(int readTimeout)
Sets read timeout.
|
void |
setRequestHeaders(Map<String,String> requestHeaders) |
void |
setRequestProperty(Map<String,String> requestProperty)
Sets request property.
|
void |
setResutlType(ResutlType resutlType)
Sets resutl type.
|
void |
setRetry_time(int retry_time)
Sets retry time.
|
void |
setShowBody(boolean showBody)
Sets show body.
|
void |
setTestssl(boolean testssl)
Sets testssl.
|
void |
setUserAgent(String userAgent)
Sets user agent.
|
void |
setUUID(String UUID)
Sets uuid.
|
public static final String MULTIPART_FROM_DATA
protected HttpConnetcionListenEvent httpConnetcionListenEvent
protected String contentCharset
protected int readTimeout
protected int connectTimeout
protected int retry_time
protected String userAgent
protected String url
protected String url_302
protected String post
protected boolean needResult
protected boolean testssl
protected int requestMethod
public HttpConnetcionEX(String url)
url - 网址public HttpConnetcionListenEvent getHttpConnetcionListenEvent()
public void setHttpConnetcionListenEvent(HttpConnetcionListenEvent httpConnetcionListenEvent)
httpConnetcionListenEvent - the http connetcion listen eventpublic File getDownloadFile()
public void setDownloadFile(File downloadFile)
downloadFile - the download filepublic String getUUID()
public void setUUID(String UUID)
UUID - the uuidpublic long getLimitSpeed()
public void setLimitSpeed(long limitSpeed)
limitSpeed - the limit speedpublic String getCookie()
public void setCookie(String Cookie)
Cookie - the cookiepublic HTTPMethod getHttpMethod()
public void setHttpMethod(HTTPMethod httpMethod)
httpMethod - the http methodpublic String getResponseCookie()
public ResutlType getResutlType()
public void setResutlType(ResutlType resutlType)
resutlType - the resutl typepublic ParamType getParamType()
public void setParamType(ParamType paramType)
paramType - the param typepublic boolean isShowBody()
public void setShowBody(boolean showBody)
showBody - the show bodypublic void setContentCharset(String contentCharset)
contentCharset - the content charsetpublic void setReadTimeout(int readTimeout)
readTimeout - the read timeoutpublic void setConnectTimeout(int connectTimeout)
connectTimeout - the connect timeoutpublic void setRetry_time(int retry_time)
retry_time - the retry timepublic boolean isNeedResult()
public void setNeedResult(boolean needResult)
needResult - the need resultpublic boolean isTestssl()
public void setTestssl(boolean testssl)
testssl - the testsslpublic void setUserAgent(String userAgent)
userAgent - the user agentpublic Map<String,List<String>> getHeaderFields()
public Map<String,String> getRequestProperty()
public void setRequestProperty(Map<String,String> requestProperty)
requestProperty - the request propertypublic String getResponseCookie(Map<String,List<String>> headerFields)
headerFields - the header fieldspublic HttpConnetcionEX.ResponseX request()
public HttpConnetcionEX.ResponseX request(Map<String,Object> params)
params - 参数public HttpConnetcionEX.ResponseX request(String Body)
Body - bodyprotected void onException(Exception e)
e - the eprotected void onResponseCodeException(int code)
code - the codepublic boolean isPrint_requestParams()
public void setPrint_requestParams(boolean print_requestParams)
print_requestParams - the print request paramspublic boolean isPrint_error()
public void setPrint_error(boolean print_error)
print_error - the print errorpublic HttpConnetcionEX deepCopt() throws Exception
Exception - the exceptionCopyright © 2020. All rights reserved.