Package org.springframework.web.client
Interface RequestCallback
public interface RequestCallback
Callback interface for code that operates on aClientHttpRequest
. Allows to manipulate the request headers, and write to the request body.Used internally by the
RestTemplate
, but also useful for application code.
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
doWithRequest(ClientHttpRequest request)
Method Detail
doWithRequest
void doWithRequest(ClientHttpRequest request) throws IOException
Gets called byRestTemplate.execute(java.lang.String, org.springframework.http.HttpMethod, org.springframework.web.client.RequestCallback, org.springframework.web.client.ResponseExtractor<T>, java.lang.Object...)
with an openedClientHttpRequest
. Does not need to care about closing the request or about handling errors: this will all be handled by theRestTemplate
.- Parameters:
request
- the active HTTP request- Throws:
IOException
- in case of I/O errors