Update ClientHttpRequestInterceptor javadoc
Clarify the interceptor is responsible for closing the response if it throws an exception after receiving it. Closes gh-29751
This commit is contained in:
		
							parent
							
								
									c7b832cfc8
								
							
						
					
					
						commit
						0542fe5232
					
				|  | @ -1,5 +1,5 @@ | |||
| /* | ||||
|  * Copyright 2002-2018 the original author or authors. | ||||
|  * Copyright 2002-2023 the original author or authors. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  | @ -21,14 +21,10 @@ import java.io.IOException; | |||
| import org.springframework.http.HttpRequest; | ||||
| 
 | ||||
| /** | ||||
|  * Intercepts client-side HTTP requests. Implementations of this interface can be | ||||
|  * {@linkplain org.springframework.web.client.RestTemplate#setInterceptors registered} | ||||
|  * with the {@link org.springframework.web.client.RestTemplate RestTemplate}, | ||||
|  * as to modify the outgoing {@link ClientHttpRequest} and/or the incoming | ||||
|  * {@link ClientHttpResponse}. | ||||
|  * | ||||
|  * <p>The main entry point for interceptors is | ||||
|  * {@link #intercept(HttpRequest, byte[], ClientHttpRequestExecution)}. | ||||
|  * Contract to intercept client-side HTTP requests. Implementations can be | ||||
|  * registered with {@link org.springframework.web.client.RestClient} or | ||||
|  * {@link org.springframework.web.client.RestTemplate} to modify the outgoing | ||||
|  * request and/or the incoming response. | ||||
|  * | ||||
|  * @author Arjen Poutsma | ||||
|  * @since 3.1 | ||||
|  | @ -55,6 +51,8 @@ public interface ClientHttpRequestInterceptor { | |||
| 	 * </ul> | ||||
| 	 * <li>Optionally wrap the response to filter HTTP attributes.</li> | ||||
| 	 * </ol> | ||||
| 	 * <p>Note: if the interceptor throws an exception after receiving a response, | ||||
| 	 * it must close the response via {@link ClientHttpResponse#close()}. | ||||
| 	 * @param request the request, containing method, URI, and headers | ||||
| 	 * @param body the body of the request | ||||
| 	 * @param execution the request execution | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue