사용자 도구

사이트 도구


springframework:resttemplate

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
springframework:resttemplate [2018/02/14 08:36]
kwon37xi
springframework:resttemplate [2018/03/09 14:36]
kwon37xi
줄 56: 줄 56:
 </code> </code>
   * 기본 구현체인 [[https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/DefaultResponseErrorHandler.html|DefaultResponseErrorHandler]]를 상속하여 필요한 메소드만 override 해도 된다.   * 기본 구현체인 [[https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/client/DefaultResponseErrorHandler.html|DefaultResponseErrorHandler]]를 상속하여 필요한 메소드만 override 해도 된다.
 +
 +===== Interceptor를 통한 로깅 =====
 +  * [[http://eclipse4j.tistory.com/282|Spring RestTemplate 에서 로그 처리]]<code java>
 +// ClientHttpRequestInterceptor 인터페이스를 로깅을 남기게 구현해서 넣어주면 된다.
 +
 +RestTemplate restTemplate = new RestTemplate();
 +restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory())); // body 스트림을 소모해버리지 않게 복제
 +restTemplate.setInterceptors(Lists.newArrayList(new RestTemplateLoggingInterceptor())); // RestTemplateLoggingInterceptor는 로그를 남기는 구현. body를 읽어버림.
 +</code>
  
springframework/resttemplate.txt · 마지막으로 수정됨: 2022/01/14 15:43 저자 kwon37xi