Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
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
邬友楠
test
Commits
722f82a8
Commit
722f82a8
authored
Aug 22, 2019
by
雍欢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CommonController - 添加文件输出拦截器
parent
d4c55cc3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
CommonController.java
...rc/main/java/com/huigou/uasp/client/CommonController.java
+8
-12
No files found.
huigou-uasp/src/main/java/com/huigou/uasp/client/CommonController.java
View file @
722f82a8
...
@@ -451,20 +451,16 @@ public class CommonController extends ControllerBase {
...
@@ -451,20 +451,16 @@ public class CommonController extends ControllerBase {
res
.
setContentType
(
ContentTypeHelper
.
getContentType
(
type
));
res
.
setContentType
(
ContentTypeHelper
.
getContentType
(
type
));
res
.
setCharacterEncoding
(
"utf-8"
);
res
.
setCharacterEncoding
(
"utf-8"
);
res
.
setHeader
(
"Content-Disposition"
,
"inline;fileName="
+
System
.
currentTimeMillis
()
+
"."
+
type
+
""
);
res
.
setHeader
(
"Content-Disposition"
,
"inline;fileName="
+
System
.
currentTimeMillis
()
+
"."
+
type
+
""
);
InputStream
is
=
null
;
ServletOutputStream
out
=
null
;
try
(
FileInputStream
fis
=
new
FileInputStream
(
file
)
;
try
{
InputStream
is
=
outputFileInterceptor
!=
null
is
=
outputFileInterceptor
!=
null
?
outputFileInterceptor
.
intercept
(
fis
,
type
,
this
)
?
outputFileInterceptor
.
intercept
(
new
FileInputStream
(
file
),
type
,
this
)
:
fis
;
:
new
FileInputStream
(
file
);
ServletOutputStream
out
=
res
.
getOutputStream
(
);
out
=
res
.
getOutputStream
();
)
{
IOUtils
.
copy
(
is
,
out
);
IOUtils
.
copy
(
is
,
out
);
res
.
flushBuffer
();
}
catch
(
Exception
e
)
{
}
catch
(
final
Exception
e
)
{
throw
new
ApplicationException
(
e
);
throw
new
ApplicationException
(
e
);
}
finally
{
IOUtils
.
closeQuietly
(
is
);
IOUtils
.
closeQuietly
(
out
);
}
}
return
null
;
return
null
;
}
}
...
...
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