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
3b0db1c1
Commit
3b0db1c1
authored
Feb 28, 2024
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
2fba11ca
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
ServletUtil.java
src/main/java/com/egolm/common/web/ServletUtil.java
+35
-0
No files found.
src/main/java/com/egolm/common/web/ServletUtil.java
View file @
3b0db1c1
...
@@ -6,6 +6,10 @@ import java.net.URLDecoder;
...
@@ -6,6 +6,10 @@ import java.net.URLDecoder;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
...
@@ -40,6 +44,37 @@ public class ServletUtil {
...
@@ -40,6 +44,37 @@ public class ServletUtil {
}
}
}
}
public
static
Map
<
String
,
Object
>
getParameterMap
(
HttpServletRequest
request
)
{
// 参数Map
Map
<
String
,
String
[]>
properties
=
request
.
getParameterMap
();
// 返回值Map
Map
<
String
,
Object
>
returnMap
=
new
HashMap
<
String
,
Object
>();
Iterator
<
Entry
<
String
,
String
[]>>
entries
=
properties
.
entrySet
().
iterator
();
Map
.
Entry
<
String
,
String
[]>
entry
;
String
name
=
""
;
String
value
=
""
;
while
(
entries
.
hasNext
())
{
entry
=
(
Map
.
Entry
<
String
,
String
[]>)
entries
.
next
();
name
=
(
String
)
entry
.
getKey
();
Object
valueObj
=
entry
.
getValue
();
if
(
null
==
valueObj
)
{
value
=
""
;
}
else
if
(
valueObj
instanceof
String
[])
{
String
[]
values
=
(
String
[])
valueObj
;
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
value
=
values
[
i
]
+
","
;
}
value
=
value
.
substring
(
0
,
value
.
length
()
-
1
);
}
else
{
value
=
valueObj
.
toString
();
}
returnMap
.
put
(
name
,
value
);
}
return
returnMap
;
}
/**
/**
*
*
* @Description 读取传入的json字符
* @Description 读取传入的json字符
...
...
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