mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2025-09-19 01:58:10 +08:00
优化:移除localBaseUrl
This commit is contained in:
@@ -35,11 +35,9 @@ 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();
|
StringBuilder pathBuilder = new StringBuilder();
|
||||||
pathBuilder.append(request.getScheme()).append("://").append(request.getServerName()).append(":")
|
pathBuilder.append(request.getScheme()).append("://").append(request.getServerName()).append(":")
|
||||||
.append(request.getServerPort()).append(((HttpServletRequest) request).getContextPath()).append("/");
|
.append(request.getServerPort()).append(((HttpServletRequest) request).getContextPath()).append("/");
|
||||||
localBaseUrl = pathBuilder.toString();
|
|
||||||
String baseUrlTmp = ConfigConstants.getBaseUrl();
|
String baseUrlTmp = ConfigConstants.getBaseUrl();
|
||||||
if (baseUrlTmp != null && !ConfigConstants.DEFAULT_BASE_URL.equals(baseUrlTmp.toLowerCase())) {
|
if (baseUrlTmp != null && !ConfigConstants.DEFAULT_BASE_URL.equals(baseUrlTmp.toLowerCase())) {
|
||||||
if (!baseUrlTmp.endsWith("/")) {
|
if (!baseUrlTmp.endsWith("/")) {
|
||||||
@@ -47,11 +45,10 @@ public class ChinesePathFilter implements Filter {
|
|||||||
}
|
}
|
||||||
baseUrl = baseUrlTmp;
|
baseUrl = baseUrlTmp;
|
||||||
} else {
|
} else {
|
||||||
baseUrl = localBaseUrl;
|
baseUrl = pathBuilder.toString();
|
||||||
}
|
}
|
||||||
BASE_URL = baseUrl;
|
BASE_URL = baseUrl;
|
||||||
request.setAttribute("baseUrl", baseUrl);
|
request.setAttribute("baseUrl", baseUrl);
|
||||||
request.setAttribute("localBaseUrl", localBaseUrl);
|
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -189,7 +189,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('${localBaseUrl}' + item.fileName ) +"'>预览</a>" +
|
item.action = "<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="+ encodeURIComponent('${baseUrl}' + 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;
|
||||||
|
Reference in New Issue
Block a user