Request.ContentType, Request.Method, Request.UserAgent| 构造器和说明 |
|---|
RequestImpl(ClientConfig clientConfig) |
| 限定符和类型 | 方法和说明 |
|---|---|
Request |
acceptEncoding(boolean acceptEncoding)
是否允许服务端压缩
|
Request |
addHeader(String name,
String value)
设置头部字段信息
|
Request |
ajax()
设置ajax请求头部
|
Request |
basicAuth(String username,
String password)
设置Basic Auth请求头部
|
Request |
boundary(String boundary)
指定boundary
|
Request |
charset(String charset)
指定编码格式
|
Request |
clone()
clone方法
|
Request |
connectTimeout(int connectTimeoutMillis)
设置连接超时时间(毫秒)
|
Request |
contentType(Request.ContentType contentType)
指定Content-Type
|
Request |
contentType(String contentType)
指定Content-Type
|
Request |
cookie(HttpCookie httpCookie)
设置Cookie头部
|
Request |
cookie(List<HttpCookie> httpCookieList)
设置Cookie头部列表
|
Request |
cookie(String cookie)
设置Cookie头部
|
Request |
cookie(String name,
String value)
设置Cookie头部
|
Request |
data(Map<String,String> dataMap)
设置表单请求参数
|
Request |
data(String key,
Path file)
设置表单请求参数
|
Request |
data(String key,
String value)
设置表单请求参数
|
void |
enqueue(ResponseListener responseListener)
异步执行请求
|
Response |
execute()
执行请求
|
Request |
followRedirects(boolean followRedirects)
是否自动重定向
|
Request |
headers(Map<String,List<String>> headerMap)
设置头部字段信息
|
Request |
ignoreHttpErrors(boolean ignoreHttpErrors)
是否忽略http错误(4xx和5xx响应码)
|
Request |
maxFollowRedirectTimes(int maxFollowRedirectTimes)
指定最大重定向次数
|
Request |
method(Request.Method method)
设置请求方法
|
Request |
method(String method)
设置请求方法
|
Request |
parameter(String key,
String value)
设置路径请求参数
|
Request |
proxy(Proxy proxy)
设置代理
|
Request |
proxy(String host,
int port)
设置代理
|
Request |
ranges(long start,
long end)
设置分段下载
|
Request |
readTimeout(int readTimeoutMillis)
设置读取超时时间(毫秒)
|
Request |
referrer(String referrer)
指定referrer
|
Request |
requestBody(com.alibaba.fastjson.JSONArray body)
设置请求体内容
|
Request |
requestBody(com.alibaba.fastjson.JSONObject body)
设置请求体内容
|
Request |
requestBody(Path file)
设置请求体内容
|
Request |
requestBody(String body)
设置请求体内容
|
RequestMeta |
requestMeta() |
Request |
retryTimes(int retryTimes)
请求超时时重试次数
|
Request |
setHeader(String name,
String value)
设置头部字段信息
|
Request |
url(String url)
指定请求地址
|
Request |
url(URL url)
指定请求地址
|
Request |
userAgent(Request.UserAgent userAgent)
指定用户代理
|
Request |
userAgent(String userAgent)
指定用户代理
|
public RequestImpl(ClientConfig clientConfig)
public Request method(Request.Method method)
Requestpublic Request basicAuth(String username, String password)
Requestpublic Request userAgent(Request.UserAgent userAgent)
Requestpublic Request contentType(String contentType)
RequestcontentType 在接口中 RequestcontentType - Content-Type头部public Request contentType(Request.ContentType contentType)
RequestcontentType 在接口中 RequestcontentType - Content-Type头部public Request acceptEncoding(boolean acceptEncoding)
RequestacceptEncoding 在接口中 RequestacceptEncoding - 是否允许服务器开启文件压缩,默认允许public Request cookie(HttpCookie httpCookie)
Requestpublic Request cookie(List<HttpCookie> httpCookieList)
Requestpublic Request requestBody(String body)
RequestrequestBody 在接口中 Requestbody - 请求体public Request requestBody(com.alibaba.fastjson.JSONObject body)
RequestrequestBody 在接口中 Requestbody - 请求体public Request requestBody(com.alibaba.fastjson.JSONArray body)
RequestrequestBody 在接口中 Requestbody - 请求体public Request requestBody(Path file) throws IOException
RequestrequestBody 在接口中 Requestfile - 上传文件IOExceptionpublic Request connectTimeout(int connectTimeoutMillis)
RequestconnectTimeout 在接口中 RequestconnectTimeoutMillis - 连接超时时间(毫秒),0表示不限制public Request readTimeout(int readTimeoutMillis)
RequestreadTimeout 在接口中 RequestreadTimeoutMillis - 读取超时时间(毫秒),0表示不限制public Request followRedirects(boolean followRedirects)
RequestfollowRedirects 在接口中 RequestfollowRedirects - 是否自动重新定定向.默认为truepublic Request maxFollowRedirectTimes(int maxFollowRedirectTimes)
RequestmaxFollowRedirectTimes 在接口中 RequestmaxFollowRedirectTimes - 最大重定向次数public Request ignoreHttpErrors(boolean ignoreHttpErrors)
RequestignoreHttpErrors 在接口中 RequestignoreHttpErrors - 忽略http错误,默认为falsepublic Request retryTimes(int retryTimes)
RequestretryTimes 在接口中 RequestretryTimes - 重试次数,默认为3次public void enqueue(ResponseListener responseListener)
Requestpublic RequestMeta requestMeta()
requestMeta 在接口中 RequestCopyright © 2021. All rights reserved.