问题描述
项目之前被下载的文档是存放在构建后的项目包/{basedir}/manual_file路径下。之后因为项目改为轻门户后端,仅使用jar包方式启动,造成原本的下载文档不可用。对下载文档部分进行了调整,对过程进行一下记录。
原方案
package.xml中配置内容
<fileSet>
<directory>${basedir}/manual_file</directory>
<outputDirectory>manual_file</outputDirectory>
<includes>
<include>*.docx</include>
</includes>
<fileMode>0755</fileMode>
</fileSet>
下载
@Override
public void downloadManual(String projectPath, HttpServletRequest request, HttpServletResponse response) {
String manualPath = StringUtils.join(new String[]{projectPath, "/manual_file/", "test.docx"});
DownloadUtils.downloadByFilePath(manualPath, request, response);
}
下载工具类
package com.changkong.util;
import java.io.Buffer