Class RestClientTracer

java.lang.Object
overit.geocall.spring.trace.client.RestClientTracer
All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequestInterceptor

@Service public class RestClientTracer extends Object implements org.springframework.http.client.ClientHttpRequestInterceptor
Implementation of interceptor that trace some generic information (included the content when available) about the request performed by the RestClient.

Following, there's an usage example


 @Service
 public class ClientService {
     @Autowired
     RestClientTracer tracer;

     public void findAll() {
         var entity = RestClient.builder()
                        .requestInterceptor(tracer)
                        .build()
                        .get()
                        .uri("https://hostname:8080/resource")
                        .retrieve()
                        .toEntity(Map.class);

     }
 }
 
  • Constructor Details

    • RestClientTracer

      @Autowired public RestClientTracer(JackMapper mapper)
  • Method Details

    • intercept

      public org.springframework.http.client.ClientHttpResponse intercept(org.springframework.http.HttpRequest request, byte[] body, @Nonnull org.springframework.http.client.ClientHttpRequestExecution execution) throws IOException
      Specified by:
      intercept in interface org.springframework.http.client.ClientHttpRequestInterceptor
      Throws:
      IOException