修改缓存时长 (#954)

pull/955/head^2
sheiy 2020-07-09 10:59:18 +08:00 committed by GitHub
parent 8734e99445
commit feefebe07f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import org.springframework.data.domain.PageImpl;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.data.web.SortHandlerMethodArgumentResolver;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.CacheControl;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@ -31,6 +32,7 @@ import run.halo.app.security.resolver.AuthenticationArgumentResolver;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
import static run.halo.app.model.support.HaloConst.FILE_SEPARATOR;
import static run.halo.app.utils.HaloUtils.*;
@ -105,6 +107,7 @@ public class WebMvcAutoConfiguration extends WebMvcConfigurationSupport {
String adminPathPattern = ensureSuffix(haloProperties.getAdminPath(), URL_SEPARATOR) + "**";
registry.addResourceHandler(uploadUrlPattern)
.setCacheControl(CacheControl.maxAge(7L, TimeUnit.DAYS))
.addResourceLocations(workDir + "upload/");
registry.addResourceHandler(adminPathPattern)
.addResourceLocations("classpath:/admin/");