注释类型 PatchRequest
@Documented
@MethodLifeCycle(PatchRequestLifeCycle.class)
@Retention(RUNTIME)
@Target({METHOD,ANNOTATION_TYPE})
public @interface PatchRequest
Patch请求信息定义注解,该注解只能修饰方法,被修饰的方法会自动被动态代理。当调用被修饰的方法时就会执行Forest动态的代理的代码,
也就会自动执行组装请求、发送请求、接受请求响应信息等任务。
- 从以下版本开始:
- 1.4.0
- 作者:
- gongjun[dt_flys@hotmail.com]
-
可选元素概要
可选元素修饰符和类型可选元素说明booleanwhether can use async http request or notCharset, Default is UTF-8int请求连接超时时间, 单位为毫秒Content Encoding of requestContent Type of requestString[]请求数据type of response data:Class<?>请求反序列化器Class<?>请求序列化器String[]request headers:
use the key-value format: key: valueClass<? extends Interceptor>[]拦截器类列表KeyStore Idboolean已过时。longMax count to retrylong上传/下载进度步长int请求读取超时时间, 单位为毫秒Response Encodingint已过时。Class of retryerSSL protocolint已过时。目标请求URL [同value属性]User Agent of request目标请求URL [同url属性]
-
元素详细资料
-
value
目标请求URL [同url属性]- 返回:
- URL字符串
- 默认值:
- ""
-
url
目标请求URL [同value属性]- 返回:
- URL字符串
- 默认值:
- ""
-
dataType
String dataTypetype of response data:text json xml binary auto
default value is "auto"
- 返回:
- type of response data
- 默认值:
- "auto"
-
async
boolean asyncwhether can use async http request or not- 返回:
true: async,false: sync
- 默认值:
- false
-
timeout
int timeout已过时。请求超时时间, 单位为毫秒- 返回:
- 请求超时时间
- 默认值:
- -1
-
connectTimeout
int connectTimeout请求连接超时时间, 单位为毫秒- 返回:
- 请求连接超时时间
- 默认值:
- -1
-
readTimeout
int readTimeout请求读取超时时间, 单位为毫秒- 返回:
- 读取超时时间
- 默认值:
- -1
-
sslProtocol
String sslProtocolSSL protocol- 返回:
- SSL protocol
- 默认值:
- ""
-
retryer
Class retryerClass of retryer- 返回:
- Class of retryer
- 默认值:
- java.lang.Object.class
-
retryCount
已过时。Max count to retry- 返回:
- Max count to retry
- 默认值:
- -1
-
maxRetryInterval
long maxRetryIntervalMax count to retry- 返回:
- Max count to retry
- 默认值:
- -1L
-
contentType
String contentTypeContent Type of request- 返回:
- Content Type
- 默认值:
- ""
-
contentEncoding
String contentEncodingContent Encoding of request- 返回:
- Content Encoding
- 默认值:
- ""
-
userAgent
String userAgentUser Agent of request- 返回:
- User Agent
- 默认值:
- ""
-
charset
String charsetCharset, Default is UTF-8- 返回:
- Charset
- 默认值:
- ""
-
responseEncoding
String responseEncodingResponse Encoding响应内容的字符编码[UTF-8, GBK...]
优先根据该字段来确认字符编码格式,再根据如下顺序来获取
- 1. 从ContentType中获取
- 2. 从响应头中的 Content-Encoding 获取
- 3. 根据响应内容智能识别
- 返回:
- Response Encoding
- 默认值:
- ""
-
headers
String[] headersrequest headers:
use the key-value format: key: value
headers = "Content-Type: application/json"multiple headers
headers = { "Content-Type: application/json", "Accept: text/plain" }variables and parameters
headers = {"Accept: ${value}"}- 返回:
- headers
- 默认值:
- {}
-
interceptor
Class<? extends Interceptor>[] interceptor拦截器类列表- 返回:
- 拦截器类列表
- 默认值:
- {}
-
data
String[] data请求数据- 返回:
- 请求数据
- 默认值:
- {}
-
progressStep
long progressStep上传/下载进度步长- 返回:
- 上传/下载进度步长
- 默认值:
- -1L
-
encoder
Class<?> encoder请求序列化器- 返回:
- 请求序列化器
- 默认值:
- java.lang.Object.class
-
decoder
Class<?> decoder请求反序列化器- 返回:
- 请求反序列化器
- 默认值:
- java.lang.Object.class
-
keyStore
String keyStoreKeyStore Id- 返回:
- KeyStore Id
- 默认值:
- ""
-
logEnabled
已过时。是否打印请求日志- 返回:
true: 打印,false: 不打印
- 默认值:
- false
-
connectTimeout()和readTimeout()