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
3ccf5c0e
Commit
3ccf5c0e
authored
Jun 22, 2022
by
RuoYi
Browse files
新增内容编码/解码方便插件集成使用
parent
db5fea92
Changes
2
Hide whitespace changes
Inline
Side-by-side
ruoyi-common/src/main/java/com/ruoyi/common/utils/ServletUtils.java
View file @
3ccf5c0e
package
com.ruoyi.common.utils
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpSession
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.core.text.Convert
;
/**
...
...
@@ -143,4 +147,40 @@ public class ServletUtils
String
ajax
=
request
.
getParameter
(
"__ajax"
);
return
StringUtils
.
inStringIgnoreCase
(
ajax
,
"json"
,
"xml"
);
}
/**
* 内容编码
*
* @param str 内容
* @return 编码后的内容
*/
public
static
String
urlEncode
(
String
str
)
{
try
{
return
URLEncoder
.
encode
(
str
,
Constants
.
UTF8
);
}
catch
(
UnsupportedEncodingException
e
)
{
return
StringUtils
.
EMPTY
;
}
}
/**
* 内容解码
*
* @param str 内容
* @return 解码后的内容
*/
public
static
String
urlDecode
(
String
str
)
{
try
{
return
URLDecoder
.
decode
(
str
,
Constants
.
UTF8
);
}
catch
(
UnsupportedEncodingException
e
)
{
return
StringUtils
.
EMPTY
;
}
}
}
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
View file @
3ccf5c0e
...
...
@@ -193,7 +193,6 @@ public class FileUploadUtils
throw
new
InvalidExtensionException
(
allowedExtension
,
extension
,
fileName
);
}
}
}
/**
...
...
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