|
|
@ -17,7 +17,6 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.apache.dolphinscheduler.api.interceptor; |
|
|
|
package org.apache.dolphinscheduler.api.interceptor; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.api.service.BaseService; |
|
|
|
|
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
import org.apache.dolphinscheduler.common.Constants; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Locale; |
|
|
|
import java.util.Locale; |
|
|
@ -30,12 +29,13 @@ import org.springframework.context.i18n.LocaleContextHolder; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.lang.Nullable; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
|
|
|
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; |
|
|
|
|
|
|
|
import org.springframework.web.util.WebUtils; |
|
|
|
|
|
|
|
|
|
|
|
public class LocaleChangeInterceptor extends HandlerInterceptorAdapter { |
|
|
|
public class LocaleChangeInterceptor extends HandlerInterceptorAdapter { |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
|
|
|
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) { |
|
|
|
Cookie cookie = BaseService.getCookie(request, Constants.LOCALE_LANGUAGE); |
|
|
|
Cookie cookie = WebUtils.getCookie(request, Constants.LOCALE_LANGUAGE); |
|
|
|
if (cookie != null) { |
|
|
|
if (cookie != null) { |
|
|
|
// Proceed in cookie
|
|
|
|
// Proceed in cookie
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|