Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cloud-backend
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
framework
cloud-backend
Commits
77c5d960
Commit
77c5d960
authored
Apr 18, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.0.0
parent
711c10e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
file-server/src/main/java/com/zq/file/controller/AccessController.java
+12
-4
No files found.
file-server/src/main/java/com/zq/file/controller/AccessController.java
View file @
77c5d960
...
...
@@ -24,12 +24,20 @@ import java.io.InputStream;
public
class
AccessController
{
@GetMapping
(
value
=
"/images/**"
,
produces
=
MediaType
.
IMAGE_JPEG_VALUE
)
public
BufferedImage
getImage
(
HttpServletRequest
request
)
throws
IOException
{
try
(
InputStream
is
=
new
FileInputStream
(
request
.
getRequestURI
()))
{
return
ImageIO
.
read
(
is
);
}
public
byte
[]
getImage
(
HttpServletRequest
request
)
throws
IOException
{
FileInputStream
inputStream
=
new
FileInputStream
(
request
.
getRequestURI
());
byte
[]
bytes
=
new
byte
[
inputStream
.
available
()];
inputStream
.
read
(
bytes
,
0
,
inputStream
.
available
());
return
bytes
;
}
// @GetMapping(value = "/images/**", produces = MediaType.IMAGE_JPEG_VALUE)
// public BufferedImage getImage(HttpServletRequest request) throws IOException {
// try (InputStream is = new FileInputStream(request.getRequestURI())) {
// return ImageIO.read(is);
// }
// }
@GetMapping
(
value
=
"/file/**"
)
public
ResponseEntity
<
Resource
>
download
(
HttpServletRequest
request
)
{
String
contentDisposition
=
ContentDisposition
...
...
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