Top Description Methods
org.springframework.web.client

public Interface RequestCallback

Known Direct Implementers
org.springframework.web.client.RestTemplate.AcceptHeaderRequestCallback
Annotations
@FunctionalInterface
Imports
java.io.IOException, java.lang.reflect.Type, org.springframework.http.client.ClientHttpRequest

Callback interface for code that operates on a ClientHttpRequest. Allows manipulating the request headers, and write to the request body.

Used internally by the RestTemplate, but also useful for application code. There several available factory methods:

Author
Arjen Poutsma
Since
3.0
See Also
RestTemplate#execute

Method Summary

Modifier and TypeMethod and Description
public void
doWithRequest(ClientHttpRequest
the active HTTP request
request
)

Gets called by RestTemplate#execute with an opened ClientHttpRequest.

Method Detail

doWithRequestback to summary
public void doWithRequest(ClientHttpRequest request) throws IOException

Gets called by RestTemplate#execute with an opened ClientHttpRequest. Does not need to care about closing the request or about handling errors: this will all be handled by the RestTemplate.

Parameters
request:ClientHttpRequest

the active HTTP request

Exceptions
IOException:
in case of I/O errors