From 9b91c5584cb6fbba46d2778f5932bd4c078685e3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 5 Sep 2017 16:27:18 +0300 Subject: fix other web configurations --- .../www/configuration/WwwServletConfiguration.java | 30 ++++------------------ 1 file changed, 5 insertions(+), 25 deletions(-) (limited to 'juick-www/src/main/java/com/juick/www/configuration') 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 1e684fa6..7a5de28c 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 @@ -17,6 +17,7 @@ package com.juick.www.configuration; +import com.juick.server.configuration.BaseWebConfiguration; import com.mitchellbosecke.pebble.PebbleEngine; import com.mitchellbosecke.pebble.extension.FormatterExtension; import com.mitchellbosecke.pebble.loader.Loader; @@ -24,31 +25,18 @@ import com.mitchellbosecke.pebble.loader.ServletLoader; import com.mitchellbosecke.pebble.spring4.PebbleViewResolver; import com.mitchellbosecke.pebble.spring4.extension.SpringExtension; import org.apache.commons.codec.CharEncoding; -import org.commonmark.ext.autolink.AutolinkExtension; -import org.commonmark.node.Image; -import org.commonmark.node.Link; -import org.commonmark.node.Node; -import org.commonmark.parser.Parser; -import org.commonmark.renderer.html.AttributeProvider; -import org.commonmark.renderer.html.AttributeProviderContext; -import org.commonmark.renderer.html.AttributeProviderFactory; -import org.commonmark.renderer.html.HtmlRenderer; 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.http.CacheControl; import org.springframework.web.servlet.ViewResolver; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -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 javax.inject.Inject; import javax.servlet.ServletContext; -import java.util.Arrays; -import java.util.Collections; -import java.util.Map; import java.util.concurrent.TimeUnit; /** @@ -57,10 +45,11 @@ import java.util.concurrent.TimeUnit; @Configuration @ComponentScan(basePackages = {"com.juick.www.controllers"}) @PropertySource("classpath:juick.conf") -public class WwwServletConfiguration extends WebMvcConfigurationSupport { +@EnableWebMvc +public class WwwServletConfiguration extends BaseWebConfiguration { @Override - protected void addResourceHandlers(ResourceHandlerRegistry registry) { + public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.setOrder(0); registry.addResourceHandler( "/scripts*.js*", @@ -77,15 +66,6 @@ public class WwwServletConfiguration extends WebMvcConfigurationSupport { .setCacheControl(CacheControl.maxAge(30, TimeUnit.DAYS).mustRevalidate().cachePublic()); } - @Override - public RequestMappingHandlerMapping requestMappingHandlerMapping() { - RequestMappingHandlerMapping result = super.requestMappingHandlerMapping(); - - result.setOrder(1); - - return result; - } - @Inject private ServletContext servletContext; -- cgit v1.2.3