修改文件下载,新增静态文件缓存
This commit is contained in:
parent
fe74fb7d72
commit
4acdf5ffaa
@ -141,7 +141,6 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
throw new SearchException("文件获取失败");
|
||||
} finally {
|
||||
try {
|
||||
if (null != outputStream) {
|
||||
@ -153,6 +152,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
} catch (Exception e1) {
|
||||
LOG.error(e1.getMessage(), e1);
|
||||
}
|
||||
throw new SearchException("文件获取失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,5 +28,6 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/files/**").addResourceLocations("file:" + fileProperties.getUploadPath());
|
||||
registry.addResourceHandler("/assets/**").addResourceLocations("classpath:/static/assets/").setCachePeriod(7 * 24 * 3600);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user