aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-05 16:27:18 +0300
committerGravatar Vitaly Takmazov2017-09-05 16:27:18 +0300
commit9b91c5584cb6fbba46d2778f5932bd4c078685e3 (patch)
tree1466a70c18b53886996e08996cead817d520a2ae
parent8e5160fcb39c90c83bcda58f1070d07a3dea498d (diff)
fix other web configurations
-rw-r--r--juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java7
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java7
-rw-r--r--juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java4
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/WwwServletConfiguration.java30
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java6
6 files changed, 18 insertions, 40 deletions
diff --git a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
index edf58f17..6ceb976b 100644
--- a/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
+++ b/juick-crosspost/src/main/java/com/juick/components/configuration/CrosspostAppConfiguration.java
@@ -22,10 +22,9 @@ import com.juick.server.configuration.BaseWebConfiguration;
import com.juick.service.CrosspostService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
@@ -35,9 +34,9 @@ import javax.inject.Inject;
* Created by aalexeev on 11/12/16.
*/
@Configuration
+@EnableWebMvc
@PropertySource("classpath:juick.conf")
-@Import(BaseWebConfiguration.class)
-public class CrosspostAppConfiguration extends WebMvcConfigurationSupport {
+public class CrosspostAppConfiguration extends BaseWebConfiguration {
@Inject
private Environment env;
@Inject
diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java
index 5f20e43e..19d56d59 100644
--- a/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java
+++ b/juick-notifications/src/main/java/com/juick/components/configuration/NotificationsAppConfiguration.java
@@ -10,7 +10,7 @@ import org.springframework.http.client.InterceptingClientHttpRequestFactory;
import org.springframework.http.client.support.BasicAuthorizationInterceptor;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import java.util.Collections;
import java.util.List;
@@ -19,12 +19,13 @@ import java.util.List;
* Created by aalexeev on 11/12/16.
*/
@Configuration
+@EnableWebMvc
@EnableScheduling
@PropertySource("classpath:juick.conf")
@ComponentScan(basePackages = "com.juick.components.service")
-@Import({ BaseWebConfiguration.class, APNSConfiguration.class, MPNSConfiguration.class,
+@Import({ APNSConfiguration.class, MPNSConfiguration.class,
GCMConfiguration.class, XMPPConfiguration.class })
-public class NotificationsAppConfiguration extends WebMvcConfigurationSupport {
+public class NotificationsAppConfiguration extends BaseWebConfiguration {
@Value("${api_user:juick}")
private String apiUser;
@Value("${api_password:secret}")
diff --git a/juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java b/juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java
index 5a023df8..45e0302d 100644
--- a/juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java
+++ b/juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java
@@ -19,10 +19,10 @@ package com.juick.rss.configuration;
import com.juick.rss.MessagesView;
import com.juick.rss.RepliesView;
+import com.juick.server.configuration.BaseWebConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.view.BeanNameViewResolver;
import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
@@ -31,7 +31,7 @@ import org.springframework.web.servlet.view.feed.AbstractRssFeedView;
*/
@Configuration
@ComponentScan(basePackages = {"com.juick.rss.controllers"})
-public class RssMvcConfiguration extends WebMvcConfigurationSupport {
+public class RssMvcConfiguration extends BaseWebConfiguration {
@Bean
public BeanNameViewResolver beanNameViewResolver() {
return new BeanNameViewResolver();
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
index a2c2d827..a4317601 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
@@ -22,7 +22,6 @@ import com.juick.server.protocol.JuickProtocol;
import com.juick.ws.WebsocketComponent;
import org.springframework.context.annotation.*;
import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.ServletWebSocketHandlerRegistry;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -37,8 +36,7 @@ import org.springframework.web.socket.server.standard.ServletServerContainerFact
@EnableScheduling
@EnableWebSocket
@PropertySource("classpath:juick.conf")
-@Import(BaseWebConfiguration.class)
-class WebsocketConfiguration extends WebMvcConfigurationSupport implements WebSocketConfigurer {
+class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
@Bean
public WebsocketComponent wsHandler() {
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;
diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
index 367c960d..92506cbd 100644
--- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
+++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang3.BooleanUtils;
import org.springframework.context.annotation.*;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import javax.inject.Inject;
import java.util.concurrent.ExecutorService;
@@ -39,9 +39,9 @@ import java.util.concurrent.Executors;
@Configuration
@ComponentScan(basePackages = {"com.juick.components.controllers"})
@PropertySource("classpath:juick.conf")
-@Import(BaseWebConfiguration.class)
@EnableScheduling
-public class XmppAppConfiguration extends WebMvcConfigurationSupport {
+@EnableWebMvc
+public class XmppAppConfiguration extends BaseWebConfiguration {
@Inject
private Environment env;