This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.filter; | |
import com.dvtt.demo.coredemo.thread.ThreadContextKeeper; | |
import com.dvtt.demo.coredemo.wrappers.BufferedRequestWrapper; | |
import com.dvtt.demo.coredemo.wrappers.BufferedResponseWrapper; | |
import com.dvtt.demo.utils.CoreUtils; | |
import lombok.extern.slf4j.Slf4j; | |
import org.apache.commons.lang3.ObjectUtils; | |
import org.apache.commons.lang3.StringUtils; | |
import org.slf4j.MDC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.filter; | |
import com.dvtt.demo.coredemo.service.LoggingServiceImpl; | |
import com.dvtt.demo.coredemo.thread.ThreadContextKeeper; | |
import lombok.extern.slf4j.Slf4j; | |
import org.apache.commons.lang3.ObjectUtils; | |
import org.springframework.http.HttpMethod; | |
import org.springframework.web.filter.OncePerRequestFilter; | |
import javax.servlet.*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.interceptor; | |
import com.dvtt.demo.coredemo.thread.ThreadContextKeeper; | |
import lombok.AllArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.http.HttpRequest; | |
import org.springframework.http.client.ClientHttpRequestExecution; | |
import org.springframework.http.client.ClientHttpRequestInterceptor; | |
import org.springframework.http.client.ClientHttpResponse; | |
import org.springframework.util.StreamUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.config; | |
import com.dvtt.demo.coredemo.interceptor.RestTemplateInterceptor; | |
import lombok.AllArgsConstructor; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.http.client.BufferingClientHttpRequestFactory; | |
import org.springframework.http.client.SimpleClientHttpRequestFactory; | |
import org.springframework.web.client.RestTemplate; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.interceptor; | |
import lombok.AllArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import org.springframework.http.HttpRequest; | |
import org.springframework.http.client.ClientHttpRequestExecution; | |
import org.springframework.http.client.ClientHttpRequestInterceptor; | |
import org.springframework.http.client.ClientHttpResponse; | |
import org.springframework.util.StreamUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.thread; | |
import com.dvtt.demo.coredemo.context.LoggingContext; | |
public class ThreadContextKeeper { | |
private static final ThreadLocal<LoggingContext> threadLocalValue = ThreadLocal.withInitial(LoggingContext::new); | |
public static LoggingContext getRequestAttributes() { | |
return threadLocalValue.get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.context; | |
import lombok.Getter; | |
import lombok.Setter; | |
@Getter | |
@Setter | |
public class LoggingContext { | |
private String requestId; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<property name="LOG_DIR" value="/var/logs/demo/distributed-tracing/handmade" /> | |
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |
<layout class="ch.qos.logback.classic.PatternLayout"> | |
<Pattern> | |
%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level [%thread] %logger{15} - %msg%n | |
</Pattern> | |
</layout> | |
</appender> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.controller; | |
import com.dvtt.demo.coredemo.service.LoggingServiceImpl; | |
import lombok.AllArgsConstructor; | |
import org.springframework.core.MethodParameter; | |
import org.springframework.http.MediaType; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.http.server.ServerHttpRequest; | |
import org.springframework.http.server.ServerHttpResponse; | |
import org.springframework.http.server.ServletServerHttpRequest; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dvtt.demo.coredemo.controller; | |
import com.dvtt.demo.coredemo.service.LoggingServiceImpl; | |
import lombok.AllArgsConstructor; | |
import org.springframework.core.MethodParameter; | |
import org.springframework.http.HttpInputMessage; | |
import org.springframework.http.converter.HttpMessageConverter; | |
import org.springframework.web.bind.annotation.ControllerAdvice; | |
import org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdviceAdapter; |
NewerOlder