Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
RuoYi Vue
Commits
1efae4a5
Commit
1efae4a5
authored
Aug 10, 2020
by
RuoYi
Browse files
优化防重复提交拦截器,接口请求非json数据不获取Body消息体
parent
a78211ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
View file @
1efae4a5
...
...
@@ -6,6 +6,7 @@ import java.util.concurrent.TimeUnit;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.MediaType
;
import
org.springframework.stereotype.Component
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.constant.Constants
;
...
...
@@ -51,8 +52,13 @@ public class SameUrlDataInterceptor extends RepeatSubmitInterceptor
@Override
public
boolean
isRepeatSubmit
(
HttpServletRequest
request
)
{
RepeatedlyRequestWrapper
repeatedlyRequest
=
(
RepeatedlyRequestWrapper
)
request
;
String
nowParams
=
HttpHelper
.
getBodyString
(
repeatedlyRequest
);
String
nowParams
=
""
;
if
(
request
instanceof
HttpServletRequest
&&
StringUtils
.
equalsAnyIgnoreCase
(
request
.
getContentType
(),
MediaType
.
APPLICATION_JSON_VALUE
,
MediaType
.
APPLICATION_JSON_UTF8_VALUE
))
{
RepeatedlyRequestWrapper
repeatedlyRequest
=
(
RepeatedlyRequestWrapper
)
request
;
nowParams
=
HttpHelper
.
getBodyString
(
repeatedlyRequest
);
}
// body参数为空,获取Parameter的数据
if
(
StringUtils
.
isEmpty
(
nowParams
))
...
...
Write
Preview
Supports
Markdown
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