aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/configuration
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-03-27 22:13:16 +0300
committerGravatar Vitaly Takmazov2018-03-27 22:22:35 +0300
commit13237626f3956d93a91a94bee6fee6aa86134a06 (patch)
tree50634fdfb2fddc924d60be18886184f49b2f7115 /juick-www/src/main/java/com/juick/www/configuration
parentcc551432bf80e4466b92c42a77a094f31408abeb (diff)
www: spring boot autoconfigured static resources
+ cache busting using Spring
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/configuration')
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java3
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java22
2 files changed, 2 insertions, 23 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java b/juick-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
index 19329dad..65871088 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
@@ -72,7 +72,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.addFilterAfter(hashParamAuthenticationFilter(), BasicAuthenticationFilter.class);
http
.authorizeRequests()
- .antMatchers("/settings", "/pm/**", "/**/bl", "/_twitter", "/post", "/comment").authenticated()
+ .antMatchers("/settings", "/pm/**", "/**/bl", "/_twitter", "/post", "/comment")
+ .authenticated()
.anyRequest().permitAll()
.and()
.anonymous().principal(JuickUser.ANONYMOUS_USER).authorities(JuickUser.ANONYMOUS_AUTHORITY)
diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
index 9c35f1c2..34720c33 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java
@@ -41,16 +41,11 @@ import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
-import org.springframework.core.Ordered;
-import org.springframework.http.CacheControl;
import org.springframework.web.servlet.ViewResolver;
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-import org.springframework.web.servlet.resource.PathResourceResolver;
import javax.inject.Inject;
import java.util.Collections;
-import java.util.concurrent.TimeUnit;
/**
* Created by aalexeev on 11/22/16.
@@ -97,23 +92,6 @@ public class WwwAppConfiguration implements WebMvcConfigurer {
public CloudflareCache cloudflareCache() {
return new CloudflareCache();
}
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
- registry.addResourceHandler(
- "/scripts*.js*",
- "/style*.css*",
- "/*.png",
- "/favicon.ico")
- .addResourceLocations("classpath:/")
- .setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS).mustRevalidate().cachePublic())
- .resourceChain(true)
- .addResolver(new PathResourceResolver());
-
- registry.addResourceHandler("/static/**")
- .addResourceLocations("/static/")
- .setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS).mustRevalidate().cachePublic());
- }
@Bean
public Loader templateLoader() {
return new ClasspathLoader();