类 DefaultRestClient.DefaultResponseSpec
java.lang.Object
cn.taketoday.web.client.DefaultRestClient.DefaultResponseSpec
- 所有已实现的接口:
RestClient.ResponseSpec
- 封闭类:
- DefaultRestClient
private class DefaultRestClient.DefaultResponseSpec
extends Object
implements RestClient.ResponseSpec
-
嵌套类概要
从接口继承的嵌套类/接口 cn.taketoday.web.client.RestClient.ResponseSpec
RestClient.ResponseSpec.ErrorHandler -
字段概要
字段修饰符和类型字段说明private final HttpRequestprivate final ClientHttpResponseprivate final intprivate final ArrayList<StatusHandler> -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明private voidapplyStatusHandlers(HttpRequest request, ClientHttpResponse response) <T> Tbody(cn.taketoday.core.ParameterizedTypeReference<T> bodyType) Extract the body as an object of the given type.<T> TExtract the body as an object of the given type.private static <T> Class<T>private MediaTypeonStatus(ResponseErrorHandler errorHandler) Provide a function to map specific error status codes to an error handler.onStatus(Predicate<HttpStatusCode> statusPredicate, RestClient.ResponseSpec.ErrorHandler errorHandler) Provide a function to map specific error status codes to an error handler.private RestClient.ResponseSpeconStatusInternal(StatusHandler statusHandler) private <T> TreadWithMessageConverters(Type bodyType, Class<T> bodyClass) Return aResponseEntitywithout a body.<T> ResponseEntity<T>toEntity(cn.taketoday.core.ParameterizedTypeReference<T> bodyType) Return aResponseEntitywith the body decoded to an Object of the given type.<T> ResponseEntity<T>Return aResponseEntitywith the body decoded to an Object of the given type.private <T> ResponseEntity<T>toEntityInternal(Type bodyType, Class<T> bodyClass)
-
字段详细资料
-
clientRequest
-
clientResponse
-
statusHandlers
-
defaultStatusHandlerCount
private final int defaultStatusHandlerCount
-
-
构造器详细资料
-
DefaultResponseSpec
DefaultResponseSpec(HttpRequest clientRequest, ClientHttpResponse clientResponse)
-
-
方法详细资料
-
onStatus
public RestClient.ResponseSpec onStatus(Predicate<HttpStatusCode> statusPredicate, RestClient.ResponseSpec.ErrorHandler errorHandler) 从接口复制的说明:RestClient.ResponseSpecProvide a function to map specific error status codes to an error handler.By default, if there are no matching status handlers, responses with status codes >= 400 wil throw a
RestClientResponseException.- 指定者:
onStatus在接口中RestClient.ResponseSpec- 参数:
statusPredicate- to match responses witherrorHandler- handler that typically, though not necessarily, throws an exception- 返回:
- this builder
-
onStatus
从接口复制的说明:RestClient.ResponseSpecProvide a function to map specific error status codes to an error handler.By default, if there are no matching status handlers, responses with status codes >= 400 wil throw a
RestClientResponseException.- 指定者:
onStatus在接口中RestClient.ResponseSpec- 参数:
errorHandler- the error handler- 返回:
- this builder
-
onStatusInternal
-
body
从接口复制的说明:RestClient.ResponseSpecExtract the body as an object of the given type.- 指定者:
body在接口中RestClient.ResponseSpec- 类型参数:
T- the body type- 参数:
bodyType- the type of return value- 返回:
- the body, or
nullif no response body was available
-
body
public <T> T body(cn.taketoday.core.ParameterizedTypeReference<T> bodyType) 从接口复制的说明:RestClient.ResponseSpecExtract the body as an object of the given type.- 指定者:
body在接口中RestClient.ResponseSpec- 类型参数:
T- the body type- 参数:
bodyType- the type of return value- 返回:
- the body, or
nullif no response body was available
-
toEntity
从接口复制的说明:RestClient.ResponseSpecReturn aResponseEntitywith the body decoded to an Object of the given type.- 指定者:
toEntity在接口中RestClient.ResponseSpec- 类型参数:
T- response body type- 参数:
bodyType- the expected response body type- 返回:
- the
ResponseEntitywith the decoded body
-
toEntity
从接口复制的说明:RestClient.ResponseSpecReturn aResponseEntitywith the body decoded to an Object of the given type.- 指定者:
toEntity在接口中RestClient.ResponseSpec- 类型参数:
T- response body type- 参数:
bodyType- the expected response body type- 返回:
- the
ResponseEntitywith the decoded body
-
toEntityInternal
-
toBodilessEntity
从接口复制的说明:RestClient.ResponseSpecReturn aResponseEntitywithout a body.- 指定者:
toBodilessEntity在接口中RestClient.ResponseSpec- 返回:
- the
ResponseEntity
-
bodyClass
-
readWithMessageConverters
-
getContentType
-
applyStatusHandlers
private void applyStatusHandlers(HttpRequest request, ClientHttpResponse response) throws IOException - 抛出:
IOException
-