aboutsummaryrefslogtreecommitdiff
path: root/juick-ws/src/main/java/com/juick/ws/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/configuration')
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java17
-rw-r--r--juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java4
2 files changed, 14 insertions, 7 deletions
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 c99d7a6d..b76545b8 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
@@ -25,25 +25,26 @@ 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.scheduling.annotation.EnableScheduling;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.ServletWebSocketHandlerRegistry;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean;
-import javax.annotation.Resource;
-import javax.inject.Inject;
-
/**
* Created by aalexeev on 11/24/16.
*/
@Configuration
-@ComponentScan(basePackages = {"com.juick.server.protocol"})
+@ComponentScan(basePackages = {"com.juick.ws.controllers"})
@EnableScheduling
@EnableWebSocket
+@EnableWebMvc
@PropertySource("classpath:juick.conf")
-class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
+public class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketConfigurer {
@Bean
public XMPPConnection xmpp() {
return new XMPPConnection();
@@ -60,7 +61,7 @@ class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketCo
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
- ((ServletWebSocketHandlerRegistry) registry).setOrder(2);
+ ((ServletWebSocketHandlerRegistry) registry).setOrder(Ordered.LOWEST_PRECEDENCE);
registry.addHandler(wsHandler(), "/**").setAllowedOrigins("*");
}
@@ -71,4 +72,8 @@ class WebsocketConfiguration extends BaseWebConfiguration implements WebSocketCo
container.setMaxBinaryMessageBufferSize(8192);
return container;
}
+ @Override
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
}
diff --git a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
index aca3cd47..42f0fac2 100644
--- a/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
+++ b/juick-ws/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
@@ -17,6 +17,8 @@
package com.juick.ws.configuration;
+import com.juick.configuration.DataConfiguration;
+import com.juick.server.configuration.StorageConfiguration;
import org.apache.commons.codec.CharEncoding;
import org.springframework.web.filter.CharacterEncodingFilter;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
@@ -30,7 +32,7 @@ public class WebsocketInitializer extends AbstractAnnotationConfigDispatcherServ
@Override
protected Class<?>[] getRootConfigClasses() {
- return new Class<?>[]{ WebsocketConfiguration.class };
+ return new Class<?>[]{ WebsocketConfiguration.class, DataConfiguration.class, StorageConfiguration.class};
}
@Override