Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rmi-upload
Project
Project
Details
Activity
Releases
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
yangshuxing
rmi-upload
Commits
5b791d36
Commit
5b791d36
authored
Oct 31, 2019
by
yangshuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加格式
parent
cc1f9913
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
OSSClientUtil.java
src/main/java/com/neusoft/upload/util/OSSClientUtil.java
+17
-21
No files found.
src/main/java/com/neusoft/upload/util/OSSClientUtil.java
View file @
5b791d36
...
@@ -144,7 +144,11 @@ public class OSSClientUtil {
...
@@ -144,7 +144,11 @@ public class OSSClientUtil {
objectMetadata
.
setHeader
(
"Pragma"
,
"no-cache"
);
objectMetadata
.
setHeader
(
"Pragma"
,
"no-cache"
);
String
type
=
getcontentType
(
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
+
1
,
fileName
.
length
()));
String
type
=
getcontentType
(
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
)
+
1
,
fileName
.
length
()));
objectMetadata
.
setContentType
(
type
);
objectMetadata
.
setContentType
(
type
);
objectMetadata
.
setContentDisposition
(
"inline;filename="
+
fileName
);
if
(
fileName
.
indexOf
(
"kml"
)
>
-
1
||
fileName
.
indexOf
(
"gps"
)
>
-
1
){
objectMetadata
.
setContentDisposition
(
"inline;filename="
+
fileName
);
}
else
{
objectMetadata
.
setContentDisposition
(
"attachment;filename="
+
fileName
);
}
PutObjectResult
putResult
=
client
.
putObject
(
BUCKET_NAME
,
filedir
+
fileName
,
instream
,
objectMetadata
);
PutObjectResult
putResult
=
client
.
putObject
(
BUCKET_NAME
,
filedir
+
fileName
,
instream
,
objectMetadata
);
ret
=
putResult
.
getETag
();
ret
=
putResult
.
getETag
();
String
fileOSSUrl
=
""
;
String
fileOSSUrl
=
""
;
...
@@ -227,41 +231,33 @@ public class OSSClientUtil {
...
@@ -227,41 +231,33 @@ public class OSSClientUtil {
System
.
out
.
println
(
extention
);
System
.
out
.
println
(
extention
);
if
(
extention
.
equalsIgnoreCase
(
"bmp"
))
{
if
(
extention
.
equalsIgnoreCase
(
"bmp"
))
{
return
"image/bmp"
;
return
"image/bmp"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"gif"
))
{
if
(
extention
.
equalsIgnoreCase
(
"gif"
))
{
return
"image/gif"
;
return
"image/gif"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"jpeg"
)
||
if
(
extention
.
equalsIgnoreCase
(
"jpeg"
)
||
extention
.
equalsIgnoreCase
(
"jpg"
)
||
extention
.
equalsIgnoreCase
(
"jpg"
)
||
extention
.
equalsIgnoreCase
(
"png"
))
{
extention
.
equalsIgnoreCase
(
"png"
))
{
return
"image/jpeg"
;
return
"image/jpeg"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"html"
))
{
if
(
extention
.
equalsIgnoreCase
(
"html"
))
{
return
"text/html"
;
return
"text/html"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"txt"
))
{
if
(
extention
.
equalsIgnoreCase
(
"txt"
))
{
return
"text/plain"
;
return
"text/plain"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"vsd"
))
{
if
(
extention
.
equalsIgnoreCase
(
"vsd"
))
{
return
"application/vnd.visio"
;
return
"application/vnd.visio"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"pptx"
)
||
if
(
extention
.
equalsIgnoreCase
(
"pptx"
)
||
extention
.
equalsIgnoreCase
(
"ppt"
))
{
extention
.
equalsIgnoreCase
(
"ppt"
))
{
return
"application/vnd.ms-powerpoint"
;
return
"application/vnd.ms-powerpoint"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"docx"
)
||
if
(
extention
.
equalsIgnoreCase
(
"docx"
)
||
extention
.
equalsIgnoreCase
(
"doc"
))
{
extention
.
equalsIgnoreCase
(
"doc"
))
{
return
"application/msword"
;
return
"application/msword"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"xml"
))
{
if
(
extention
.
equalsIgnoreCase
(
"xml"
))
{
return
"text/xml"
;
return
"text/xml"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"xls"
)
||
if
(
extention
.
equalsIgnoreCase
(
"xls"
)
||
extention
.
equalsIgnoreCase
(
"xlsx"
))
{
extention
.
equalsIgnoreCase
(
"xlsx"
))
{
return
"application/vnd.ms-excel"
;
return
"application/vnd.ms-excel"
;
}
}
else
if
(
extention
.
equalsIgnoreCase
(
"pdf"
))
{
if
(
extention
.
equalsIgnoreCase
(
"pdf"
))
{
return
"application/pdf"
;
return
"application/pdf"
;
}
else
if
(
extention
.
equalsIgnoreCase
(
"kml"
)
||
extention
.
equalsIgnoreCase
(
"gpx"
)){
return
"application/octet-stream"
;
}
}
return
"image/jpeg"
;
return
"image/jpeg"
;
}
}
...
...
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