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
506a3ba2
Commit
506a3ba2
authored
Nov 21, 2019
by
陈精华
Committed by
kl
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化:服务器无法通过外网访问本地下载时,使用内网IP下载
parent
12f197b6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
5 deletions
+9
-5
application.properties
jodconverter-web/src/main/config/application.properties
+1
-0
ChinesePathFilter.java
...eb/src/main/java/cn/keking/filters/ChinesePathFilter.java
+7
-4
index.ftl
jodconverter-web/src/main/resources/web/index.ftl
+1
-1
No files found.
jodconverter-web/src/main/config/application.properties
View file @
506a3ba2
#######################################不可动态配置,需要重启生效#######################################
#######################################不可动态配置,需要重启生效#######################################
server.port
=
${KK_SERVER_PORT:8012}
server.port
=
${KK_SERVER_PORT:8012}
server.context-path
=
${KK_CONTEXT_PATH:/}
spring.http.encoding.charset
=
utf8
spring.http.encoding.charset
=
utf8
## Freemarker 配置
## Freemarker 配置
spring.freemarker.template-loader-path
=
classpath:/web/
spring.freemarker.template-loader-path
=
classpath:/web/
...
...
jodconverter-web/src/main/java/cn/keking/filters/ChinesePathFilter.java
View file @
506a3ba2
...
@@ -23,6 +23,11 @@ public class ChinesePathFilter implements Filter {
...
@@ -23,6 +23,11 @@ public class ChinesePathFilter implements Filter {
request
.
setCharacterEncoding
(
"UTF-8"
);
request
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
String
baseUrl
;
String
baseUrl
;
String
localBaseUrl
;
StringBuilder
pathBuilder
=
new
StringBuilder
();
pathBuilder
.
append
(
request
.
getScheme
()).
append
(
"://"
).
append
(
request
.
getServerName
()).
append
(
":"
)
.
append
(
request
.
getServerPort
()).
append
(((
HttpServletRequest
)
request
).
getContextPath
()).
append
(
"/"
);
localBaseUrl
=
pathBuilder
.
toString
();
String
baseUrlTmp
=
ConfigConstants
.
getBaseUrl
();
String
baseUrlTmp
=
ConfigConstants
.
getBaseUrl
();
if
(
baseUrlTmp
!=
null
&&
!
ConfigRefreshComponent
.
DEFAULT_BASE_URL
.
equals
(
baseUrlTmp
.
toLowerCase
()))
{
if
(
baseUrlTmp
!=
null
&&
!
ConfigRefreshComponent
.
DEFAULT_BASE_URL
.
equals
(
baseUrlTmp
.
toLowerCase
()))
{
if
(!
baseUrlTmp
.
endsWith
(
"/"
))
{
if
(!
baseUrlTmp
.
endsWith
(
"/"
))
{
...
@@ -30,12 +35,10 @@ public class ChinesePathFilter implements Filter {
...
@@ -30,12 +35,10 @@ public class ChinesePathFilter implements Filter {
}
}
baseUrl
=
baseUrlTmp
;
baseUrl
=
baseUrlTmp
;
}
else
{
}
else
{
StringBuilder
pathBuilder
=
new
StringBuilder
();
baseUrl
=
localBaseUrl
;
pathBuilder
.
append
(
request
.
getScheme
()).
append
(
"://"
).
append
(
request
.
getServerName
()).
append
(
":"
)
.
append
(
request
.
getServerPort
()).
append
(((
HttpServletRequest
)
request
).
getContextPath
()).
append
(
"/"
);
baseUrl
=
pathBuilder
.
toString
();
}
}
request
.
setAttribute
(
"baseUrl"
,
baseUrl
);
request
.
setAttribute
(
"baseUrl"
,
baseUrl
);
request
.
setAttribute
(
"localBaseUrl"
,
localBaseUrl
);
chain
.
doFilter
(
request
,
response
);
chain
.
doFilter
(
request
,
response
);
}
}
...
...
jodconverter-web/src/main/resources/web/index.ftl
View file @
506a3ba2
...
@@ -187,7 +187,7 @@ window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(fil
...
@@ -187,7 +187,7 @@ window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(fil
}).
on
(
'pre-body.bs.table'
,
function
(
e
,
data
)
{
}).
on
(
'pre-body.bs.table'
,
function
(
e
,
data
)
{
// 每个data添加一列用来操作
// 每个data添加一列用来操作
$
(
data
).
each
(
function
(
index
,
item
)
{
$
(
data
).
each
(
function
(
index
,
item
)
{
item
.
action
=
"<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="
+
encodeURIComponent
(
'${
b
aseUrl}'
+
item
.
fileName
)
+
"'>预览</a>"
+
item
.
action
=
"<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="
+
encodeURIComponent
(
'${
localB
aseUrl}'
+
item
.
fileName
)
+
"'>预览</a>"
+
"<a class='btn btn-default' href='javascript:void(0);' onclick='deleteFile(
\"
"
+
item
.
fileName
+
"
\"
)'>删除</a>"
;
"<a class='btn btn-default' href='javascript:void(0);' onclick='deleteFile(
\"
"
+
item
.
fileName
+
"
\"
)'>删除</a>"
;
});
});
return
data
;
return
data
;
...
...
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