aboutsummaryrefslogtreecommitdiff
path: root/juick-spring-www/src/main/java/com/juick/www/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'juick-spring-www/src/main/java/com/juick/www/configuration')
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java7
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java3
-rw-r--r--juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java23
3 files changed, 18 insertions, 15 deletions
diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
index 65d07dba..dcbd5459 100644
--- a/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
+++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WebSecurityConfig.java
@@ -6,7 +6,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
-import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@@ -30,12 +29,6 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
super(true);
}
- @Bean("authManager")
- @Override
- public AuthenticationManager authenticationManagerBean() throws Exception {
- return super.authenticationManagerBean();
- }
-
@Bean("userDetailsService")
@Override
public UserDetailsService userDetailsServiceBean() throws Exception {
diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
index 6b7b4ebc..6abb9f79 100644
--- a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
+++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwInitializer.java
@@ -5,7 +5,6 @@ import com.juick.configuration.SearchConfiguration;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
-import javax.servlet.Filter;
import javax.servlet.FilterRegistration;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@@ -45,7 +44,7 @@ public class WwwInitializer extends AbstractAnnotationConfigDispatcherServletIni
encodingFilter.setForceEncoding(true);
FilterRegistration.Dynamic registration = servletContext.addFilter(
- "encodingFilter", new CharacterEncodingFilter());
+ "encodingFilter", new CharacterEncodingFilter());
registration.addMappingForUrlPatterns(null, true, "/*");
}
diff --git a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
index 01cee39f..869fd651 100644
--- a/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
+++ b/juick-spring-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java
@@ -11,8 +11,9 @@ import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
-import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
+import org.springframework.web.servlet.resource.PathResourceResolver;
import org.thymeleaf.spring4.SpringTemplateEngine;
import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
import org.thymeleaf.spring4.view.ThymeleafViewResolver;
@@ -84,16 +85,21 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(0);
- registry.addResourceHandler("/scripts.js").addResourceLocations("/");
- registry.addResourceHandler("/style.css").addResourceLocations("/");
- registry.addResourceHandler("/favicon.ico").addResourceLocations("/static/favicon.ico");
+ registry.addResourceHandler(
+ "/scripts.js*",
+ "/style.css*",
+ "/*.png",
+ "/favicon.ico")
+ .addResourceLocations("/")
+ .resourceChain(true)
+ .addResolver(new PathResourceResolver());
}
@Bean
public ResourceBundleMessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
- messageSource.setBasename("messages");
+ messageSource.setBasenames("messages", "errors");
messageSource.setDefaultEncoding("UTF-8");
messageSource.setFallbackToSystemLocale(false);
@@ -101,6 +107,11 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport {
}
@Override
- protected void addViewControllers(ViewControllerRegistry registry) {
+ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
+ RequestMappingHandlerMapping result = super.requestMappingHandlerMapping();
+
+ result.setOrder(1);
+
+ return result;
}
}