This commit is contained in:
Looly
2022-04-16 12:05:50 +08:00
parent 6acf0854d8
commit 08da23b3d4
4 changed files with 19 additions and 10 deletions

View File

@@ -17,6 +17,7 @@ public enum GlobalInterceptor {
* 设置拦截器,用于在请求前重新编辑请求 * 设置拦截器,用于在请求前重新编辑请求
* *
* @param interceptor 拦截器实现 * @param interceptor 拦截器实现
* @return this
*/ */
synchronized public GlobalInterceptor addRequestInterceptor(HttpInterceptor<HttpRequest> interceptor) { synchronized public GlobalInterceptor addRequestInterceptor(HttpInterceptor<HttpRequest> interceptor) {
this.requestInterceptors.addChain(interceptor); this.requestInterceptors.addChain(interceptor);
@@ -27,6 +28,7 @@ public enum GlobalInterceptor {
* 设置拦截器,用于在响应读取后完成编辑或读取 * 设置拦截器,用于在响应读取后完成编辑或读取
* *
* @param interceptor 拦截器实现 * @param interceptor 拦截器实现
* @return this
*/ */
synchronized public GlobalInterceptor addResponseInterceptor(HttpInterceptor<HttpResponse> interceptor) { synchronized public GlobalInterceptor addResponseInterceptor(HttpInterceptor<HttpResponse> interceptor) {
this.responseInterceptors.addChain(interceptor); this.responseInterceptors.addChain(interceptor);

View File

@@ -244,6 +244,7 @@ public class HttpConfig {
* 如果服务端未遵循这个规范或响应没有正常结束会报EOF异常此选项用于是否忽略这个异常。 * 如果服务端未遵循这个规范或响应没有正常结束会报EOF异常此选项用于是否忽略这个异常。
* *
* @param ignoreEOFError 是否忽略响应读取时可能的EOF异常。 * @param ignoreEOFError 是否忽略响应读取时可能的EOF异常。
* @return this
* @since 5.7.20 * @since 5.7.20
*/ */
public HttpConfig setIgnoreEOFError(boolean ignoreEOFError) { public HttpConfig setIgnoreEOFError(boolean ignoreEOFError) {
@@ -257,6 +258,7 @@ public class HttpConfig {
* 按照RFC3986规范在发送请求时全部编码之。如果为{@code false},则不会解码已经编码的内容,在请求时只编码需要编码的部分。 * 按照RFC3986规范在发送请求时全部编码之。如果为{@code false},则不会解码已经编码的内容,在请求时只编码需要编码的部分。
* *
* @param decodeUrl 是否忽略解码URL * @param decodeUrl 是否忽略解码URL
* @return this
*/ */
public HttpConfig setDecodeUrl(boolean decodeUrl) { public HttpConfig setDecodeUrl(boolean decodeUrl) {
this.decodeUrl = decodeUrl; this.decodeUrl = decodeUrl;
@@ -267,6 +269,7 @@ public class HttpConfig {
* 设置拦截器,用于在请求前重新编辑请求 * 设置拦截器,用于在请求前重新编辑请求
* *
* @param interceptor 拦截器实现 * @param interceptor 拦截器实现
* @return this
*/ */
public HttpConfig addRequestInterceptor(HttpInterceptor<HttpRequest> interceptor) { public HttpConfig addRequestInterceptor(HttpInterceptor<HttpRequest> interceptor) {
this.requestInterceptors.addChain(interceptor); this.requestInterceptors.addChain(interceptor);

View File

@@ -372,6 +372,7 @@ public class JSONObject extends MapWrapper<String, Object> implements JSON, JSON
* @param key 键 * @param key 键
* @param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL. * @param value 值对象. 可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
* @param filter 键值对过滤编辑器,可以通过实现此接口,完成解析前对键值对的过滤和修改操作,{@code null}表示不过滤 * @param filter 键值对过滤编辑器,可以通过实现此接口,完成解析前对键值对的过滤和修改操作,{@code null}表示不过滤
* @param checkDuplicate 是否检查重复键,如果为{@code true},则出现重复键时抛出{@link JSONException}异常
* @return this. * @return this.
* @throws JSONException 值是无穷数字抛出此异常 * @throws JSONException 值是无穷数字抛出此异常
* @since 5.8.0 * @since 5.8.0
@@ -425,7 +426,8 @@ public class JSONObject extends MapWrapper<String, Object> implements JSON, JSON
* *
* @param key 键 * @param key 键
* @param value 值对象,可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL. * @param value 值对象,可以是以下类型: Boolean, Double, Integer, JSONArray, JSONObject, Long, String, or the JSONNull.NULL.
* @return this. * @param filter 键值对过滤编辑器,可以通过实现此接口,完成解析前对键值对的过滤和修改操作,{@code null}表示不过滤
* @return this
* @throws JSONException 值是无穷数字、键重复抛出异常 * @throws JSONException 值是无穷数字、键重复抛出异常
* @since 5.8.0 * @since 5.8.0
*/ */

View File

@@ -34,6 +34,7 @@ public class JSONParser {
} }
// region parseTo // region parseTo
/** /**
* 解析{@link JSONTokener}中的字符到目标的{@link JSONObject}中 * 解析{@link JSONTokener}中的字符到目标的{@link JSONObject}中
* *
@@ -91,7 +92,8 @@ public class JSONParser {
/** /**
* 解析JSON字符串到{@link JSONArray}中 * 解析JSON字符串到{@link JSONArray}中
* *
* @param jsonArray {@link JSONArray} * @param jsonArray {@link JSONArray
* @param filter 键值对过滤编辑器,可以通过实现此接口,完成解析前对值的过滤和修改操作,{@code null}表示不过滤
*/ */
public void parseTo(JSONArray jsonArray, Filter<Mutable<Object>> filter) { public void parseTo(JSONArray jsonArray, Filter<Mutable<Object>> filter) {
final JSONTokener x = this.tokener; final JSONTokener x = this.tokener;