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
@Slf4j | |
public class MdcLoggingInterceptor implements HandlerInterceptor { | |
public static final String REQUEST_URL_MDC_KEY = "URL"; | |
public static final String REQUEST_CONTROLLER_MDC_KEY = "Controller"; | |
@Override | |
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { | |
if (handler instanceof HandlerMethod) { | |
String fullUrl = request.getRequestURI() + Optional.ofNullable(request.getQueryString()).map(qs -> "?" + qs).orElse(""); |
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
import java.util.function.Function; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Optional; | |
import java.util.stream.Collectors; | |
public class Demo { | |
/** | |
* An IO operation that results in a value of type T. |