Skip to content

Commit b90e326

Browse files
gitchenjhklboke
authored andcommitted
优化:移除localBaseUrl
1 parent 66e2acd commit b90e326

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

jodconverter-web/src/main/java/cn/keking/web/filter/ChinesePathFilter.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,20 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
3535
request.setCharacterEncoding("UTF-8");
3636
response.setCharacterEncoding("UTF-8");
3737
String baseUrl;
38-
String localBaseUrl;
3938
StringBuilder pathBuilder = new StringBuilder();
4039
pathBuilder.append(request.getScheme()).append("://").append(request.getServerName()).append(":")
4140
.append(request.getServerPort()).append(((HttpServletRequest) request).getContextPath()).append("/");
42-
localBaseUrl = pathBuilder.toString();
4341
String baseUrlTmp = ConfigConstants.getBaseUrl();
4442
if (baseUrlTmp != null && !ConfigConstants.DEFAULT_BASE_URL.equals(baseUrlTmp.toLowerCase())) {
4543
if (!baseUrlTmp.endsWith("/")) {
4644
baseUrlTmp = baseUrlTmp.concat("/");
4745
}
4846
baseUrl = baseUrlTmp;
4947
} else {
50-
baseUrl = localBaseUrl;
48+
baseUrl = pathBuilder.toString();
5149
}
5250
BASE_URL = baseUrl;
5351
request.setAttribute("baseUrl", baseUrl);
54-
request.setAttribute("localBaseUrl", localBaseUrl);
5552
chain.doFilter(request, response);
5653
}
5754

jodconverter-web/src/main/resources/web/index.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(fil
189189
}).on('pre-body.bs.table', function (e,data) {
190190
// 每个data添加一列用来操作
191191
$(data).each(function (index, item) {
192-
item.action = "<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="+ encodeURIComponent('${localBaseUrl}' + item.fileName ) +"'>预览</a>" +
192+
item.action = "<a class='btn btn-default' target='_blank' href='${baseUrl}onlinePreview?url="+ encodeURIComponent('${baseUrl}' + item.fileName ) +"'>预览</a>" +
193193
"<a class='btn btn-default' href='javascript:void(0);' onclick='deleteFile(\""+item.fileName+"\")'>删除</a>";
194194
});
195195
return data;

0 commit comments

Comments
 (0)