Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sentinel
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sentinel
Commits
27fe7b54
Commit
27fe7b54
authored
Nov 13, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fdsf
parent
8b819a24
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
LocaleCookieInterceptor.java
...golm/film/config/interceptor/LocaleCookieInterceptor.java
+4
-6
No files found.
src/main/java/com/egolm/film/config/interceptor/LocaleCookieInterceptor.java
View file @
27fe7b54
...
@@ -10,8 +10,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
...
@@ -10,8 +10,6 @@ import org.springframework.context.i18n.LocaleContextHolder;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
com.egolm.common.StringUtil
;
@Component
@Component
public
class
LocaleCookieInterceptor
extends
HandlerInterceptorAdapter
{
public
class
LocaleCookieInterceptor
extends
HandlerInterceptorAdapter
{
...
@@ -24,12 +22,12 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
...
@@ -24,12 +22,12 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
for
(
Cookie
cookie
:
cookies
)
{
for
(
Cookie
cookie
:
cookies
)
{
if
(
cookie
.
getName
().
equals
(
language
))
{
if
(
cookie
.
getName
().
equals
(
language
))
{
String
str
=
cookie
.
getValue
();
String
str
=
cookie
.
getValue
();
if
(
StringUtil
.
isBlank
(
str
)
)
{
if
(
str
==
null
||
str
.
trim
().
length
()
==
0
)
{
str
=
"zh_CN"
;
str
=
"zh_CN"
;
}
}
String
[]
kv
=
str
.
split
(
"_"
);
String
[]
kv
=
str
.
trim
().
split
(
"_"
,
2
);
String
language
=
kv
[
0
];
String
language
=
kv
[
0
];
String
country
=
kv
.
length
==
2
?
kv
[
1
]
:
null
;
String
country
=
kv
.
length
>
1
?
kv
[
1
]
:
null
;
LocaleContextHolder
.
setLocale
(
new
Locale
(
language
,
country
));
LocaleContextHolder
.
setLocale
(
new
Locale
(
language
,
country
));
return
super
.
preHandle
(
req
,
resp
,
handler
);
return
super
.
preHandle
(
req
,
resp
,
handler
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment