spring-framework / org.springframework.web.client

Package org.springframework.web.client

Types

AsyncRequestCallback

interface AsyncRequestCallback

Callback interface for code that operates on an org.springframework.http.client.AsyncClientHttpRequest. Allows to manipulate the request headers, and write to the request body.

Used internally by the AsyncRestTemplate, but also useful for application code.

ExtractingResponseErrorHandler

open class ExtractingResponseErrorHandler : DefaultResponseErrorHandler

Implementation of ResponseErrorHandler that uses HttpMessageConverters to convert HTTP error responses to RestClientException.

To use this error handler, you must specify a status mapping and/or a series mapping. If either of these mappings has a match for the status code of a given ClientHttpResponse, #hasError(ClientHttpResponse) will return true and #handleError(ClientHttpResponse) will attempt to use the configured message converters to convert the response into the mapped subclass of RestClientException. Note that the status mapping takes precedence over series mapping.

If there is no match, this error handler will default to the behavior of DefaultResponseErrorHandler. Note that you can override this default behavior by specifying a series mapping from HttpStatus.Series#CLIENT_ERROR and/or HttpStatus.Series#SERVER_ERROR to null.

HttpMessageConverterExtractor

open class HttpMessageConverterExtractor<T : Any> : ResponseExtractor<T>

Response extractor that uses the given HttpMessageConverter to convert the response into a type T.

Exceptions

HttpClientErrorException

open class HttpClientErrorException : HttpStatusCodeException

Exception thrown when an HTTP 4xx is received.

HttpServerErrorException

open class HttpServerErrorException : HttpStatusCodeException

Exception thrown when an HTTP 5xx is received.

ResourceAccessException

open class ResourceAccessException : RestClientException

Exception thrown when an I/O error occurs.

UnknownHttpStatusCodeException

open class UnknownHttpStatusCodeException : RestClientResponseException

Exception thrown when an unknown (or custom) HTTP status code is received.

Functions

exchange

fun <T : Any> RestOperations.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>, vararg uriVariables: Any): ResponseEntity<T>
fun <T : Any> RestOperations.exchange(url: String, method: HttpMethod, requestEntity: HttpEntity<*>, uriVariables: Map<String, *>): ResponseEntity<T>
fun <T : Any> RestOperations.exchange(url: URI, method: HttpMethod, requestEntity: HttpEntity<*>): ResponseEntity<T>
fun <T : Any> RestOperations.exchange(requestEntity: RequestEntity<*>): ResponseEntity<T>

Extension for RestOperations.exchange avoiding specifying the type parameter thanks to Kotlin reified type parameters.

getForEntity

fun <T : Any> RestOperations.getForEntity(url: URI): ResponseEntity<T>
fun <T : Any> RestOperations.getForEntity(url: String, vararg uriVariables: Any): ResponseEntity<T>
fun <T : Any> RestOperations.getForEntity(url: String, uriVariables: Map<String, *>): ResponseEntity<T>

Extension for RestOperations.getForEntity avoiding requiring the type parameter thanks to Kotlin reified type parameters.

getForObject

fun <T : Any> RestOperations.getForObject(url: String, vararg uriVariables: Any): T?
fun <T : Any> RestOperations.getForObject(url: String, uriVariables: Map<String, Any?>): T?

Extension for RestOperations.getForObject avoiding specifying the type parameter thanks to Kotlin reified type parameters.

fun <T : Any> RestOperations.getForObject(url: URI): T?

Extension for RestOperations.getForObject avoiding specifying the type parameter thanks to Kotlin reified type parameters.

patchForObject

fun <T : Any> RestOperations.patchForObject(url: String, request: Any, vararg uriVariables: Any): T?
fun <T : Any> RestOperations.patchForObject(url: String, request: Any, uriVariables: Map<String, *>): T?
fun <T : Any> RestOperations.patchForObject(url: URI, request: Any): T?

Extension for RestOperations.patchForObject avoiding specifying the type parameter thanks to Kotlin reified type parameters.

postForEntity

fun <T : Any> RestOperations.postForEntity(url: String, request: Any, vararg uriVariables: Any): ResponseEntity<T>
fun <T : Any> RestOperations.postForEntity(url: String, request: Any, uriVariables: Map<String, *>): ResponseEntity<T>
fun <T : Any> RestOperations.postForEntity(url: URI, request: Any): ResponseEntity<T>

Extension for RestOperations.postForEntity avoiding specifying the type parameter thanks to Kotlin reified type parameters.

postForObject

fun <T : Any> RestOperations.postForObject(url: String, request: Any, vararg uriVariables: Any): T?
fun <T : Any> RestOperations.postForObject(url: String, request: Any, uriVariables: Map<String, *>): T?
fun <T : Any> RestOperations.postForObject(url: URI, request: Any): T?

Extension for RestOperations.postForObject avoiding specifying the type parameter thanks to Kotlin reified type parameters.