Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
C
common
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
曲欣亮
common
Commits
e7123efa
Commit
e7123efa
authored
Sep 10, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b770bb10
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
7 deletions
+24
-7
ServletUtil.java
src/main/java/com/egolm/common/web/ServletUtil.java
+24
-7
No files found.
src/main/java/com/egolm/common/web/ServletUtil.java
View file @
e7123efa
...
...
@@ -39,14 +39,14 @@ public class ServletUtil {
throw
new
PluginException
(
e
);
}
}
/**
*
* @Description 读取传入的json字符
* @param request
* @return
* @return String
* @throws
* @author 曲欣亮
* @throws @author 曲欣亮
* @date 2016年5月17日
* @since 2016年5月17日
*/
...
...
@@ -54,10 +54,10 @@ public class ServletUtil {
String
json
=
""
;
try
{
Enumeration
<?>
names
=
request
.
getParameterNames
();
if
(
names
.
hasMoreElements
())
{
json
=
(
String
)
names
.
nextElement
();
if
(
names
.
hasMoreElements
())
{
json
=
(
String
)
names
.
nextElement
();
}
if
(
json
==
null
||
json
.
length
()
==
0
)
{
if
(
json
==
null
||
json
.
length
()
==
0
)
{
json
=
StringUtil
.
read
(
request
.
getReader
());
}
}
catch
(
Exception
e
)
{
...
...
@@ -71,8 +71,9 @@ public class ServletUtil {
return
json
;
}
}
public
static
String
covertFileName
(
HttpServletRequest
request
,
String
fileName
)
throws
UnsupportedEncodingException
{
public
static
String
covertFileName
(
HttpServletRequest
request
,
String
fileName
)
throws
UnsupportedEncodingException
{
String
userAgent
=
request
.
getHeader
(
"User-Agent"
).
toLowerCase
();
System
.
out
.
println
(
userAgent
);
String
excelFileName
=
""
;
...
...
@@ -85,4 +86,20 @@ public class ServletUtil {
}
return
excelFileName
;
}
public
static
String
getHostIp
()
{
try
{
return
InetAddress
.
getLocalHost
().
getHostAddress
();
}
catch
(
UnknownHostException
e
)
{
}
return
"127.0.0.1"
;
}
public
static
String
getHostName
()
{
try
{
return
InetAddress
.
getLocalHost
().
getHostName
();
}
catch
(
UnknownHostException
e
)
{
}
return
"未知"
;
}
}
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