12

Basically as the title says. Apache HttpClient and Spring RestTemplate allow for defining custom interceptors which wrap around requests/responses and allow for additional (global) modification of request parameters, logging, etc...

I do not see such a feature available in standard Java implementation of java.net.http.HttpClient (as of Java 11). Am I missing something or is there no way to intercept all requests/responses on a single HttpClient?

4

1 回答 1

3

没有内置解决方案,但您可以编写自己的代码,如this answer或使用此interceptable-http-client库。

于 2020-10-22T23:58:37.473 回答