Commit b3e7e08f authored by Quxl's avatar Quxl

x

parent b26a4f0e
package com.egolm.film.config; package com.egolm.film.config;
import java.text.SimpleDateFormat;
import java.util.EventListener; import java.util.EventListener;
import javax.servlet.http.Cookie; import javax.servlet.http.Cookie;
...@@ -23,6 +24,7 @@ import com.egolm.film.config.interceptor.AdminLoginInterceptor; ...@@ -23,6 +24,7 @@ import com.egolm.film.config.interceptor.AdminLoginInterceptor;
import com.egolm.film.config.interceptor.LocaleInterceptor; import com.egolm.film.config.interceptor.LocaleInterceptor;
import com.egolm.film.config.interceptor.MemberLoginInterceptor; import com.egolm.film.config.interceptor.MemberLoginInterceptor;
import com.egolm.film.config.interceptor.UserLoginInterceptor; import com.egolm.film.config.interceptor.UserLoginInterceptor;
import com.fasterxml.jackson.databind.ObjectMapper;
@Configuration @Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter { public class WebMvcConfig extends WebMvcConfigurerAdapter {
...@@ -60,7 +62,12 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter { ...@@ -60,7 +62,12 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return registrationBean; return registrationBean;
} }
public static HttpServletRequest getRequest() { @Bean
public ObjectMapper getObjectMapper(){
return new ObjectMapper().setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
}
public static HttpServletRequest getRequest() {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
if(servletRequestAttributes != null) { if(servletRequestAttributes != null) {
return servletRequestAttributes.getRequest(); return servletRequestAttributes.getRequest();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment