Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
6d054b70
Commit
6d054b70
authored
Jul 23, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
f7904cec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
api-server/src/main/java/com/zq/api/interceptor/ApiInterceptor.java
+4
-5
No files found.
api-server/src/main/java/com/zq/api/interceptor/ApiInterceptor.java
View file @
6d054b70
...
...
@@ -26,9 +26,9 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
String
uri
=
request
.
getRequestURI
(
);
String
queryString
=
request
.
getQueryString
();
log
.
debug
(
"
请求URI: {}"
,
request
.
getRequestURL
());
String
ip
=
ServletUtil
.
getClientIP
(
request
);
log
.
debug
(
"
{}请求URI: {}"
,
ip
,
request
.
getRequestURL
());
long
start
=
System
.
currentTimeMillis
();
...
...
@@ -42,7 +42,6 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
}
// 黑名单
String
ip
=
ServletUtil
.
getClientIP
(
request
);
String
blackIps
=
ConfigCache
.
getValue
(
"API.IP.BLACK"
);
if
(
StrUtil
.
isNotBlank
(
ip
)
&&
StrUtil
.
isNotBlank
(
blackIps
))
{
List
<
String
>
ipList
=
Arrays
.
asList
(
blackIps
.
split
(
","
));
...
...
@@ -72,7 +71,7 @@ public class ApiInterceptor extends HandlerInterceptorAdapter {
// 调试日志
if
(
ApiUtils
.
DEBUG
)
{
log
.
info
(
"API DEBUG INTERCEPTOR \n[path="
+
uri
+
"/"
+
queryString
+
"]"
log
.
info
(
"API DEBUG INTERCEPTOR \n[path="
+
request
.
getRequestURI
()
+
"/"
+
request
.
getQueryString
()
+
"]"
+
"[from:"
+
form
+
"]"
+
"\n[time="
+
(
System
.
currentTimeMillis
()
-
start
)
+
"ms]"
);
}
...
...
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