aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java5
-rw-r--r--src/main/java/com/juick/ws/configuration/WebsocketInitializer.java33
2 files changed, 37 insertions, 1 deletions
diff --git a/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java b/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
index a56e56f51..a298d0a03 100644
--- a/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
+++ b/src/main/java/com/juick/ws/configuration/WebsocketConfiguration.java
@@ -9,6 +9,8 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
@@ -20,10 +22,11 @@ import javax.inject.Inject;
* Created by vitalyster on 28.06.2016.
*/
@Configuration
+@EnableWebMvc
@EnableWebSocket
@ComponentScan(basePackages = {"com.juick"})
@PropertySource("classpath:juick.conf")
-public class WebsocketConfiguration implements WebSocketConfigurer {
+public class WebsocketConfiguration extends WebMvcConfigurerAdapter implements WebSocketConfigurer {
@Inject
Environment env;
diff --git a/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java b/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
new file mode 100644
index 000000000..89017f8ba
--- /dev/null
+++ b/src/main/java/com/juick/ws/configuration/WebsocketInitializer.java
@@ -0,0 +1,33 @@
+package com.juick.ws.configuration;
+import org.springframework.web.filter.CharacterEncodingFilter;
+import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
+
+import javax.servlet.Filter;
+
+/**
+ * Created by vt on 09/02/16.
+ */
+public class WebsocketInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return new Class[] {WebsocketConfiguration.class};
+ }
+
+ @Override
+ protected Class<?>[] getServletConfigClasses() {
+ return null;
+ }
+
+ @Override
+ protected String[] getServletMappings() {
+ return new String[] {
+ "/"
+ };
+ }
+ @Override
+ protected Filter[] getServletFilters() {
+ CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
+ characterEncodingFilter.setEncoding("UTF-8");
+ return new Filter[] { characterEncodingFilter};
+ }
+}