Commit 57062a76 authored by Quxl's avatar Quxl

xx

parent b7277067
......@@ -6,6 +6,7 @@ import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
......@@ -16,10 +17,12 @@ import com.egolm.common.StringUtil;
public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
public static final String language = "i18n_language";
private static final Logger logger = Logger.getLogger(LocaleCookieInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
String str = this.getParameterValue(req, language);
logger.debug(language + " = " + str + " -> " + req.getRequestURI());
if(str == null || !str.matches("[a-z]{2}_[A-Z]{2}")) {
str = "zh_CN";
}
......
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