aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-06 14:23:07 +0300
committerGravatar Vitaly Takmazov2017-09-06 14:23:07 +0300
commit8094d66534f47ed302d271da4dba1147fe6b2a3c (patch)
treedcb2701d2462dd94f9964fa05e75ea02d6d06064 /juick-www/src/main/java/com
parent346c39037d6e5e9c2d006ac43439f865f418a62c (diff)
www: cleanup and fix configuration
Diffstat (limited to 'juick-www/src/main/java/com')
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java5
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java8
2 files changed, 9 insertions, 4 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
index d77bbdad..3a97c4be 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
@@ -19,7 +19,6 @@ package com.juick.www.configuration;
import com.juick.configuration.DataConfiguration;
import com.juick.configuration.SearchConfiguration;
-import com.juick.server.configuration.BaseWebConfiguration;
import org.apache.commons.codec.CharEncoding;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@@ -36,7 +35,7 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni
@Override
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[]{
- BaseWebConfiguration.class,
+ WwwServletConfiguration.class,
WwwAppConfiguration.class,
DataConfiguration.class,
SearchConfiguration.class,
@@ -47,7 +46,7 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni
@Override
protected Class<?>[] getServletConfigClasses() {
- return new Class<?>[]{WwwServletConfiguration.class};
+ return null;
}
@Override
diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
index 7a5de28c..cad8cfdb 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
@@ -29,8 +29,10 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.Ordered;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.resource.PathResourceResolver;
@@ -50,7 +52,7 @@ public class WwwServletConfiguration extends BaseWebConfiguration {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.setOrder(0);
+ registry.setOrder(Ordered.HIGHEST_PRECEDENCE);
registry.addResourceHandler(
"/scripts*.js*",
"/style*.css*",
@@ -65,6 +67,10 @@ public class WwwServletConfiguration extends BaseWebConfiguration {
.addResourceLocations("/static/")
.setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS).mustRevalidate().cachePublic());
}
+ @Override
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
@Inject
private ServletContext servletContext;