接口 ClientResponse

    • 方法详细资料

      • body

        <T> T body​(BodyExtractor<T,​? super ClientHttpResponse> extractor)
        Extract the body with the given BodyExtractor.
        类型参数:
        T - the type of the body returned
        参数:
        extractor - the BodyExtractor that reads from the response
        返回:
        the extracted body
      • bodyToMono

        <T> reactor.core.publisher.Mono<T> bodyToMono​(Class<? extends T> elementClass)
        Extract the body to a Mono.
        类型参数:
        T - the element type
        参数:
        elementClass - the class of element in the Mono
        返回:
        a mono containing the body of the given type T
      • bodyToMono

        <T> reactor.core.publisher.Mono<T> bodyToMono​(ParameterizedTypeReference<T> elementTypeRef)
        Extract the body to a Mono.
        类型参数:
        T - the element type
        参数:
        elementTypeRef - the type reference of element in the Mono
        返回:
        a mono containing the body of the given type T
      • bodyToFlux

        <T> reactor.core.publisher.Flux<T> bodyToFlux​(Class<? extends T> elementClass)
        Extract the body to a Flux.
        类型参数:
        T - the element type
        参数:
        elementClass - the class of elements in the Flux
        返回:
        a flux containing the body of the given type T
      • bodyToFlux

        <T> reactor.core.publisher.Flux<T> bodyToFlux​(ParameterizedTypeReference<T> elementTypeRef)
        Extract the body to a Flux.
        类型参数:
        T - the element type
        参数:
        elementTypeRef - the type reference of elements in the Flux
        返回:
        a flux containing the body of the given type T
      • toEntity

        <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity​(Class<T> bodyClass)
        Return this response as a delayed ResponseEntity.
        类型参数:
        T - response body type
        参数:
        bodyClass - the expected response body type
        返回:
        Mono with the ResponseEntity
      • toEntity

        <T> reactor.core.publisher.Mono<ResponseEntity<T>> toEntity​(ParameterizedTypeReference<T> bodyTypeReference)
        Return this response as a delayed ResponseEntity.
        类型参数:
        T - response body type
        参数:
        bodyTypeReference - a type reference describing the expected response body type
        返回:
        Mono with the ResponseEntity
      • toEntityList

        <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList​(Class<T> elementClass)
        Return this response as a delayed list of ResponseEntitys.
        类型参数:
        T - the type of elements in the list
        参数:
        elementClass - the expected response body list element class
        返回:
        Mono with the list of ResponseEntitys
      • toEntityList

        <T> reactor.core.publisher.Mono<ResponseEntity<List<T>>> toEntityList​(ParameterizedTypeReference<T> elementTypeRef)
        Return this response as a delayed list of ResponseEntitys.
        类型参数:
        T - the type of elements in the list
        参数:
        elementTypeRef - the expected response body list element reference type
        返回:
        Mono with the list of ResponseEntitys
      • toBodilessEntity

        reactor.core.publisher.Mono<ResponseEntity<Void>> toBodilessEntity()
        Return this response as a delayed ResponseEntity containing status and headers, but no body. Calling this method will release the body of the response.
        返回:
        Mono with the bodiless ResponseEntity
        从以下版本开始:
        5.2
      • logPrefix

        String logPrefix()
        Return a log message prefix to use to correlate messages for this exchange.

        The prefix is based on ClientRequest.logPrefix(), which itself is based on the value of the LOG_ID_ATTRIBUTE request attribute, further surrounded with "[" and "]".

        返回:
        the log message prefix or an empty String if the LOG_ID_ATTRIBUTE is not set
        从以下版本开始:
        5.2.3
      • from

        static ClientResponse.Builder from​(ClientResponse other)
        Create a builder with the status, headers, and cookies of the given response.
        参数:
        other - the response to copy the status, headers, and cookies from
        返回:
        the created builder
      • create

        static ClientResponse.Builder create​(HttpStatus statusCode)
        Create a response builder with the given status code and using default strategies for reading the body.
        参数:
        statusCode - the status code
        返回:
        the created builder
      • create

        static ClientResponse.Builder create​(HttpStatus statusCode,
                                             ExchangeStrategies strategies)
        Create a response builder with the given status code and strategies for reading the body.
        参数:
        statusCode - the status code
        strategies - the strategies
        返回:
        the created builder
      • create

        static ClientResponse.Builder create​(int statusCode,
                                             ExchangeStrategies strategies)
        Create a response builder with the given raw status code and strategies for reading the body.
        参数:
        statusCode - the status code
        strategies - the strategies
        返回:
        the created builder
        从以下版本开始:
        5.1.9