Package com.xxl.tool.http.http
Class HttpRequest
java.lang.Object
com.xxl.tool.http.http.HttpRequest
Http Request
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription设置鉴权信息设置请求体 bodyconnectTimeout(int connectTimeout) 设置连接超时时间contentType(ContentType contentType) 设置Content-Type设置Cookie设置Cookie,覆盖更新execute()send request设置表单 form设置表单 form设置表单 form,覆盖更新getAuth()getBody()int获取格式化后的 Cookie: name1=value1; name2=value2; name3=value3 (Cookie 格式是一个键值对字符串,多个键值对之间用分号和空格分隔)getForm()intgetUrl()设置请求头设置请求头,覆盖更新设置请求头, 默认值interceptor(HttpInterceptor interceptor) 设置拦截器interceptor(List<HttpInterceptor> interceptors) 设置拦截器,覆盖更新boolean设置MethodreadTimeout(int readTimeout) 设置读取超时时间设置请求体 request设置URLuseCaches(boolean useCaches)
-
Constructor Details
-
HttpRequest
public HttpRequest()
-
-
Method Details
-
url
设置URL -
method
设置Method -
contentType
设置Content-Type -
header
设置请求头,覆盖更新 -
header
设置请求头 -
headerDefault
设置请求头, 默认值 -
cookie
设置Cookie,覆盖更新 -
cookie
设置Cookie -
connectTimeout
设置连接超时时间 -
readTimeout
设置读取超时时间 -
useCaches
-
body
设置请求体 body -
request
设置请求体 request- Parameters:
request- 请求体对象,将会序列化为 json (body 数据)- Returns:
- this
-
form
设置表单 form -
form
设置表单 form -
form
设置表单 form,覆盖更新 -
auth
设置鉴权信息 -
interceptor
设置拦截器,覆盖更新 -
interceptor
设置拦截器 -
getCookieString
获取格式化后的 Cookie: name1=value1; name2=value2; name3=value3 (Cookie 格式是一个键值对字符串,多个键值对之间用分号和空格分隔) -
getUrl
-
getMethod
-
getContentType
-
getHeader
-
getCookie
-
getConnectTimeout
public int getConnectTimeout() -
getReadTimeout
public int getReadTimeout() -
isUseCaches
public boolean isUseCaches() -
getBody
-
getForm
-
getAuth
-
execute
send request- Returns:
- HttpResponse
-