Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
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
梁杰芳
slm-fileview
Commits
8b33a233
Commit
8b33a233
authored
Aug 11, 2020
by
陈精华
Committed by
Gitee
Aug 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
!15 2.2.1版
Merge pull request !15 from 陈精华/master
parents
40ac4b1e
9e2962bb
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
26 deletions
+34
-26
Dockerfile
Dockerfile
+3
-3
pom.xml
jodconverter-web/pom.xml
+1
-1
startup.bat
jodconverter-web/src/main/bin/startup.bat
+2
-2
startup.sh
jodconverter-web/src/main/bin/startup.sh
+1
-1
DownloadUtils.java
...rter-web/src/main/java/cn/keking/utils/DownloadUtils.java
+24
-17
OnlinePreviewController.java
...ava/cn/keking/web/controller/OnlinePreviewController.java
+2
-1
pom.xml
pom.xml
+1
-1
No files found.
Dockerfile
View file @
8b33a233
...
@@ -25,5 +25,5 @@ ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
...
@@ -25,5 +25,5 @@ ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV
PATH $PATH:$JAVA_HOME/bin
ENV
PATH $PATH:$JAVA_HOME/bin
ENV
LANG zh_CN.UTF-8
ENV
LANG zh_CN.UTF-8
ENV
LC_ALL zh_CN.UTF-8
ENV
LC_ALL zh_CN.UTF-8
ENV
KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.2.1-SNAPSHOT/bin
ENV
KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.2.1/bin
ENTRYPOINT
["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.2.1-SNAPSHOT/config/application.properties","-jar","/opt/kkFileView-2.2.1-SNAPSHOT/bin/kkFileView-2.2.1-SNAPSHOT.jar"]
ENTRYPOINT
["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.2.1/config/application.properties","-jar","/opt/kkFileView-2.2.1/bin/kkFileView-2.2.1.jar"]
\ No newline at end of file
\ No newline at end of file
jodconverter-web/pom.xml
View file @
8b33a233
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
<groupId>
cn.keking
</groupId>
<groupId>
cn.keking
</groupId>
<artifactId>
kkFileView
</artifactId>
<artifactId>
kkFileView
</artifactId>
<version>
2.2.1
-SNAPSHOT
</version>
<version>
2.2.1
</version>
<properties>
<properties>
...
...
jodconverter-web/src/main/bin/startup.bat
View file @
8b33a233
...
@@ -6,4 +6,4 @@ echo Starting kkFileView...
...
@@ -6,4 +6,4 @@ echo Starting kkFileView...
echo Please check log file in ../log/kkFileView.log for more information
echo Please check log file in ../log/kkFileView.log for more information
echo You can get help in our official homesite: https://kkFileView.keking.cn
echo You can get help in our official homesite: https://kkFileView.keking.cn
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\config\application.properties -jar kkFileView-2.2.1-SNAPSHOT.jar -> ..\log\kkFileView.log
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\config\application.properties -jar kkFileView-2.2.1.jar -> ..\log\kkFileView.log
\ No newline at end of file
\ No newline at end of file
jodconverter-web/src/main/bin/startup.sh
View file @
8b33a233
...
@@ -29,4 +29,4 @@ echo "Starting kkFileView..."
...
@@ -29,4 +29,4 @@ echo "Starting kkFileView..."
echo
"Please execute ./showlog.sh to check log for more information"
echo
"Please execute ./showlog.sh to check log for more information"
echo
"You can get help in our official homesite: https://kkFileView.keking.cn"
echo
"You can get help in our official homesite: https://kkFileView.keking.cn"
echo
"If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
echo
"If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
nohup
java
-Dfile
.encoding
=
UTF-8
-Dsun
.java2d.cmm
=
sun.java2d.cmm.kcms.KcmsServiceProvider
-Dspring
.config.location
=
../config/application.properties
-jar
kkFileView-2.2.1
-SNAPSHOT
.jar
>
../log/kkFileView.log 2>&1 &
nohup
java
-Dfile
.encoding
=
UTF-8
-Dsun
.java2d.cmm
=
sun.java2d.cmm.kcms.KcmsServiceProvider
-Dspring
.config.location
=
../config/application.properties
-jar
kkFileView-2.2.1.jar
>
../log/kkFileView.log 2>&1 &
jodconverter-web/src/main/java/cn/keking/utils/DownloadUtils.java
View file @
8b33a233
...
@@ -56,9 +56,10 @@ public class DownloadUtils {
...
@@ -56,9 +56,10 @@ public class DownloadUtils {
}
}
try
{
try
{
URL
url
=
new
URL
(
urlStr
);
URL
url
=
new
URL
(
urlStr
);
OutputStream
os
=
new
FileOutputStream
(
new
File
(
realPath
));
if
(
url
.
getProtocol
()
!=
null
&&
url
.
getProtocol
().
toLowerCase
().
startsWith
(
"http"
))
{
if
(
url
.
getProtocol
()
!=
null
&&
url
.
getProtocol
().
toLowerCase
().
startsWith
(
"http"
))
{
saveToOutputStreamFromUrl
(
urlStr
,
os
);
byte
[]
bytes
=
getBytesFromUrl
(
urlStr
);
OutputStream
os
=
new
FileOutputStream
(
new
File
(
realPath
));
saveBytesToOutStream
(
bytes
,
os
);
}
else
if
(
url
.
getProtocol
()
!=
null
&&
"ftp"
.
equals
(
url
.
getProtocol
().
toLowerCase
()))
{
}
else
if
(
url
.
getProtocol
()
!=
null
&&
"ftp"
.
equals
(
url
.
getProtocol
().
toLowerCase
()))
{
String
ftpUsername
=
fileUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_USERNAME
);
String
ftpUsername
=
fileUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_USERNAME
);
String
ftpPassword
=
fileUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_PASSWORD
);
String
ftpPassword
=
fileUtils
.
getUrlParameterReg
(
fileAttribute
.
getUrl
(),
URL_PARAM_FTP_PASSWORD
);
...
@@ -88,21 +89,24 @@ public class DownloadUtils {
...
@@ -88,21 +89,24 @@ public class DownloadUtils {
}
}
}
}
public
b
oolean
saveToOutputStreamFromUrl
(
String
urlStr
,
OutputStream
os
)
throws
IOException
{
public
b
yte
[]
getBytesFromUrl
(
String
urlStr
)
throws
IOException
{
InputStream
is
=
getInputStreamFromUrl
(
urlStr
);
InputStream
is
=
getInputStreamFromUrl
(
urlStr
);
if
(
is
!=
null
)
{
if
(
is
!=
null
)
{
copyStream
(
is
,
o
s
);
return
getBytesFromStream
(
i
s
);
}
else
{
}
else
{
urlStr
=
URLUtil
.
normalize
(
urlStr
,
true
,
true
);
urlStr
=
URLUtil
.
normalize
(
urlStr
,
true
,
true
);
is
=
getInputStreamFromUrl
(
urlStr
);
is
=
getInputStreamFromUrl
(
urlStr
);
if
(
is
!=
null
)
{
if
(
is
==
null
)
{
copyStream
(
is
,
os
);
logger
.
error
(
"文件下载异常:url:{}"
,
urlStr
);
}
else
{
throw
new
IOException
(
"文件下载异常:url:"
+
urlStr
);
os
.
close
();
return
false
;
}
}
return
getBytesFromStream
(
is
);
}
}
return
true
;
}
public
void
saveBytesToOutStream
(
byte
[]
b
,
OutputStream
os
)
throws
IOException
{
os
.
write
(
b
);
os
.
close
();
}
}
private
InputStream
getInputStreamFromUrl
(
String
urlStr
)
{
private
InputStream
getInputStreamFromUrl
(
String
urlStr
)
{
...
@@ -119,14 +123,17 @@ public class DownloadUtils {
...
@@ -119,14 +123,17 @@ public class DownloadUtils {
}
}
}
}
private
void
copyStream
(
InputStream
is
,
OutputStream
os
)
throws
IOException
{
private
byte
[]
getBytesFromStream
(
InputStream
is
)
throws
IOException
{
byte
[]
bs
=
new
byte
[
1024
];
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
int
len
;
byte
[]
buffer
=
new
byte
[
1024
];
while
(-
1
!=
(
len
=
is
.
read
(
bs
)))
{
int
len
=
0
;
os
.
write
(
bs
,
0
,
len
);
while
((
len
=
is
.
read
(
buffer
))
!=
-
1
)
{
}
baos
.
write
(
buffer
,
0
,
len
);
}
byte
[]
b
=
baos
.
toByteArray
();
is
.
close
();
is
.
close
();
os
.
close
();
baos
.
close
();
return
b
;
}
}
/**
/**
...
...
jodconverter-web/src/main/java/cn/keking/web/controller/OnlinePreviewController.java
View file @
8b33a233
...
@@ -88,7 +88,8 @@ public class OnlinePreviewController {
...
@@ -88,7 +88,8 @@ public class OnlinePreviewController {
public
void
getCorsFile
(
String
urlPath
,
HttpServletResponse
response
)
{
public
void
getCorsFile
(
String
urlPath
,
HttpServletResponse
response
)
{
logger
.
info
(
"下载跨域pdf文件url:{}"
,
urlPath
);
logger
.
info
(
"下载跨域pdf文件url:{}"
,
urlPath
);
try
{
try
{
downloadUtils
.
saveToOutputStreamFromUrl
(
urlPath
,
response
.
getOutputStream
());
byte
[]
bytes
=
downloadUtils
.
getBytesFromUrl
(
urlPath
);
downloadUtils
.
saveBytesToOutStream
(
bytes
,
response
.
getOutputStream
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
logger
.
error
(
"下载跨域pdf文件异常,url:{}"
,
urlPath
,
e
);
logger
.
error
(
"下载跨域pdf文件异常,url:{}"
,
urlPath
,
e
);
}
}
...
...
pom.xml
View file @
8b33a233
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<groupId>
cn.keking
</groupId>
<groupId>
cn.keking
</groupId>
<artifactId>
filepreview
</artifactId>
<artifactId>
filepreview
</artifactId>
<version>
2.2.1
-SNAPSHOT
</version>
<version>
2.2.1
</version>
<modules>
<modules>
<module>
jodconverter-core
</module>
<module>
jodconverter-core
</module>
<module>
jodconverter-web
</module>
<module>
jodconverter-web
</module>
...
...
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