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"); |  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  * you may not use this file except in compliance with 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; | import org.springframework.http.HttpRequest; | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Intercepts client-side HTTP requests. Implementations of this interface can be |  * Contract to intercept client-side HTTP requests. Implementations can be | ||||||
|  * {@linkplain org.springframework.web.client.RestTemplate#setInterceptors registered} |  * registered with {@link org.springframework.web.client.RestClient} or | ||||||
|  * with the {@link org.springframework.web.client.RestTemplate RestTemplate}, |  * {@link org.springframework.web.client.RestTemplate} to modify the outgoing | ||||||
|  * as to modify the outgoing {@link ClientHttpRequest} and/or the incoming |  * request and/or the incoming response. | ||||||
|  * {@link ClientHttpResponse}. |  | ||||||
|  * |  | ||||||
|  * <p>The main entry point for interceptors is |  | ||||||
|  * {@link #intercept(HttpRequest, byte[], ClientHttpRequestExecution)}. |  | ||||||
|  * |  * | ||||||
|  * @author Arjen Poutsma |  * @author Arjen Poutsma | ||||||
|  * @since 3.1 |  * @since 3.1 | ||||||
|  | @ -55,6 +51,8 @@ public interface ClientHttpRequestInterceptor { | ||||||
| 	 * </ul> | 	 * </ul> | ||||||
| 	 * <li>Optionally wrap the response to filter HTTP attributes.</li> | 	 * <li>Optionally wrap the response to filter HTTP attributes.</li> | ||||||
| 	 * </ol> | 	 * </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 request the request, containing method, URI, and headers | ||||||
| 	 * @param body the body of the request | 	 * @param body the body of the request | ||||||
| 	 * @param execution the request execution | 	 * @param execution the request execution | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue