@FunctionalInterface
public interface RequestCallback
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:
| Modifier and Type | Method and Description |
|---|---|
void |
doWithRequest(ClientHttpRequest request)
|
void doWithRequest(ClientHttpRequest request) throws java.io.IOException
RestTemplate.execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...) 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.request - the active HTTP requestjava.io.IOException - in case of I/O errors