beginners of Java and spring boot, recently want to be interceptors of resttemplate, and found methods in interceptors
ClientHttpResponse intercept (HttpRequest request, byte [] body, ClientHttpRequestExecution execution)
parameter is the request information of the httpRequest, project in actual combat. Generally, the two methods of javax.servlet.http.httpservletRequest
are also different. The HttpServlet object can only be indexed by the header name, and the getheaders of HttpRequest returns the complete HttpHeader object, and the method makes it clear that the return value is not empty.
/**
* Return the headers of this message.
* @return a corresponding HttpHeaders object (never {@code null})
*/
HttpHeaders getHeaders();
this is also a bit confusing. What do you get if you build a request,httpRequest with header as null through HttpEntity request = new HttpEntity < > (body, headers);?
what are the connections and differences between the two? I have already googled and failed to find a suitable answer. Thank you