// Path: src/main/java/com/sivalabs/jblogger/web/interceptors/WebRequestLogger.java
// @Component
// public class WebRequestLogger extends HandlerInterceptorAdapter
// {
// 	private static final String USER_CONTEXT_KEY = "UserContextKey";
// 	private Logger logger = LoggerFactory.getLogger(getClass());
// 	
// 	@Override
// 	public boolean preHandle(
//             HttpServletRequest request,
//             HttpServletResponse response,
//             Object handler) throws Exception {
// 		
// 		String mdcUserContextKey = "["+request.getRemoteHost()+":"+request.getSession().getId()+"]";
// 		MDC.put(USER_CONTEXT_KEY, mdcUserContextKey);
//         
//         Calendar cal = Calendar.getInstance();
//         String url = request.getRequestURI();
//         String referrer = request.getHeader("referer");
// 		logger.debug("Incoming Request: "+cal.getTime());
// 		logger.debug("URL: "+url);
// 		logger.debug("Referrer: "+referrer);
// 		return true;
//     }
// 	
// 	@Override
// 	public void postHandle(HttpServletRequest request,
// 						   HttpServletResponse response,
// 						   Object handler,
// 	        			   ModelAndView modelAndView) throws Exception
// 	{
// 		super.postHandle(request, response, handler, modelAndView);
// 		MDC.remove(USER_CONTEXT_KEY);
// 	}
// }


import com.sivalabs.jblogger.web.interceptors.WebRequestLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;
package com.sivalabs.jblogger.config;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer
{
	@Autowired
	private MessageSource messageSource;

	@Autowired
// Path: src/main/java/com/sivalabs/jblogger/web/interceptors/WebRequestLogger.java
// @Component
// public class WebRequestLogger extends HandlerInterceptorAdapter
// {
// 	private static final String USER_CONTEXT_KEY = "UserContextKey";
// 	private Logger logger = LoggerFactory.getLogger(getClass());
// 	
// 	@Override
// 	public boolean preHandle(
//             HttpServletRequest request,
//             HttpServletResponse response,
//             Object handler) throws Exception {
// 		
// 		String mdcUserContextKey = "["+request.getRemoteHost()+":"+request.getSession().getId()+"]";
// 		MDC.put(USER_CONTEXT_KEY, mdcUserContextKey);
//         
//         Calendar cal = Calendar.getInstance();
//         String url = request.getRequestURI();
//         String referrer = request.getHeader("referer");
// 		logger.debug("Incoming Request: "+cal.getTime());
// 		logger.debug("URL: "+url);
// 		logger.debug("Referrer: "+referrer);
// 		return true;
//     }
// 	
// 	@Override
// 	public void postHandle(HttpServletRequest request,
// 						   HttpServletResponse response,
// 						   Object handler,
// 	        			   ModelAndView modelAndView) throws Exception
// 	{
// 		super.postHandle(request, response, handler, modelAndView);
// 		MDC.remove(USER_CONTEXT_KEY);
// 	}
// }


// Path: src/main/java/com/sivalabs/jblogger/config/WebMvcConfig.java
import com.sivalabs.jblogger.web.interceptors.WebRequestLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect;
import org.thymeleaf.extras.springsecurity5.dialect.SpringSecurityDialect;

package com.sivalabs.jblogger.config;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer
{
	@Autowired
	private MessageSource messageSource;

	@Autowired
	private WebRequestLogger webRequestLogger;