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
4a9692aa
Commit
4a9692aa
authored
Jul 31, 2019
by
张永
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
aa71e6cf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
72 deletions
+88
-72
ServletUtil.java
src/main/java/com/egolm/common/web/ServletUtil.java
+88
-72
No files found.
src/main/java/com/egolm/common/web/ServletUtil.java
View file @
4a9692aa
package
com
.
egolm
.
common
.
web
;
package
com
.
egolm
.
common
.
web
;
import
java.io.UnsupportedEncodingException
;
import
java.net.InetAddress
;
import
java.net.InetAddress
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
import
java.net.URLEncoder
;
import
java.net.UnknownHostException
;
import
java.net.UnknownHostException
;
import
java.util.Enumeration
;
import
java.util.Enumeration
;
...
@@ -69,4 +71,18 @@ public class ServletUtil {
...
@@ -69,4 +71,18 @@ public class ServletUtil {
return
json
;
return
json
;
}
}
}
}
public
static
String
covertFileName
(
HttpServletRequest
request
,
String
fileName
)
throws
UnsupportedEncodingException
{
String
userAgent
=
request
.
getHeader
(
"User-Agent"
).
toLowerCase
();
System
.
out
.
println
(
userAgent
);
String
excelFileName
=
""
;
if
(
userAgent
.
indexOf
(
"msie"
)
!=
-
1
)
{
// IE浏览器
excelFileName
=
URLEncoder
.
encode
(
fileName
,
"UTF8"
);
}
else
if
(
userAgent
.
indexOf
(
"firefox"
)
!=
-
1
)
{
// google,火狐浏览器
excelFileName
=
new
String
(
fileName
.
getBytes
(),
"ISO-8859-1"
);
}
else
{
excelFileName
=
URLEncoder
.
encode
(
fileName
,
"UTF8"
);
// 其他浏览器
}
return
excelFileName
;
}
}
}
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