Top Description Inners Fields Constructors Methods
org.springframework.web.client

pack-priv final Class StatusHandler

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, java.nio.charset.Charset, .StandardCharsets, java.util.List, java.util.function.Function, .Predicate, org.springframework.core.ResolvableType, org.springframework.core.log.LogFormatUtils, org.springframework.http.HttpHeaders, .HttpRequest, .HttpStatusCode, org.springframework.http.client.ClientHttpResponse, org.springframework.http.converter.HttpMessageConverter, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .ObjectUtils

Used by DefaultRestClient and DefaultRestClientBuilder.
Author
Arjen Poutsma
Since
6.1

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface

Field Summary

Modifier and TypeField and Description
private final RestClient.ResponseSpec.ErrorHandler
private final StatusHandler.ResponsePredicate

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static StatusHandler
defaultHandler(List<HttpMessageConverter<?>> messageConverters)

public static StatusHandler
private static String
getErrorMessage(int rawStatusCode, String statusText, byte[] responseBody, Charset charset)

public void
private static Function<ResolvableType, ?>
initBodyConvertFunction(ClientHttpResponse response, byte[] body, List<HttpMessageConverter<?>> messageConverters)

public static StatusHandler
public boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

errorHandlerback to summary
private final RestClient.ResponseSpec.ErrorHandler errorHandler
predicateback to summary
private final StatusHandler.ResponsePredicate predicate

Constructor Detail

StatusHandlerback to summary
private StatusHandler(StatusHandler.ResponsePredicate predicate, RestClient.ResponseSpec.ErrorHandler errorHandler)

Method Detail

defaultHandlerback to summary
public static StatusHandler defaultHandler(List<HttpMessageConverter<?>> messageConverters)
fromErrorHandlerback to summary
public static StatusHandler fromErrorHandler(ResponseErrorHandler errorHandler)
getErrorMessageback to summary
private static String getErrorMessage(int rawStatusCode, String statusText, byte[] responseBody, Charset charset)
handleback to summary
public void handle(HttpRequest request, ClientHttpResponse response) throws IOException
initBodyConvertFunctionback to summary
private static Function<ResolvableType, ?> initBodyConvertFunction(ClientHttpResponse response, byte[] body, List<HttpMessageConverter<?>> messageConverters)
ofback to summary
public static StatusHandler of(Predicate<HttpStatusCode> predicate, RestClient.ResponseSpec.ErrorHandler errorHandler)
testback to summary
public boolean test(ClientHttpResponse response) throws IOException
org.springframework.web.client back to summary

private Interface StatusHandler.ResponsePredicate

Annotations
@FunctionalInterface

Method Summary

Modifier and TypeMethod and Description
public boolean

Method Detail

testback to summary
public boolean test(ClientHttpResponse response) throws IOException