aboutsummaryrefslogtreecommitdiff
path: root/juick-rss/src/main/java/com/juick/rss/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'juick-rss/src/main/java/com/juick/rss/configuration')
-rw-r--r--juick-rss/src/main/java/com/juick/rss/configuration/RssAppConfiguration.java17
-rw-r--r--juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java40
-rw-r--r--juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java20
3 files changed, 77 insertions, 0 deletions
diff --git a/juick-rss/src/main/java/com/juick/rss/configuration/RssAppConfiguration.java b/juick-rss/src/main/java/com/juick/rss/configuration/RssAppConfiguration.java
new file mode 100644
index 00000000..15195aba
--- /dev/null
+++ b/juick-rss/src/main/java/com/juick/rss/configuration/RssAppConfiguration.java
@@ -0,0 +1,17 @@
+package com.juick.rss.configuration;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
+
+import javax.inject.Inject;
+
+/**
+ * Created by aalexeev on 11/12/16.
+ */
+@Configuration
+@PropertySource("classpath:juick.conf")
+public class RssAppConfiguration {
+ @Inject
+ private Environment env;
+}
diff --git a/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java b/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java
new file mode 100644
index 00000000..a66fcca7
--- /dev/null
+++ b/juick-rss/src/main/java/com/juick/rss/configuration/RssInitializer.java
@@ -0,0 +1,40 @@
+package com.juick.rss.configuration;
+
+import com.juick.configuration.DataConfiguration;
+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 RssInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
+
+ @Override
+ protected Class<?>[] getRootConfigClasses() {
+ return new Class<?>[]{RssAppConfiguration.class, DataConfiguration.class};
+ }
+
+ @Override
+ protected Class<?>[] getServletConfigClasses() {
+ return new Class<?>[]{RssMvcConfiguration.class};
+ }
+
+ @Override
+ protected String[] getServletMappings() {
+ return new String[]{"/"};
+ }
+
+ @Override
+ protected Filter[] getServletFilters() {
+ CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter();
+ characterEncodingFilter.setEncoding("UTF-8");
+ return new Filter[]{characterEncodingFilter};
+ }
+
+ @Override
+ protected String getServletName() {
+ return "RSS dispatcher servlet";
+ }
+}
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
new file mode 100644
index 00000000..f975d87b
--- /dev/null
+++ b/juick-rss/src/main/java/com/juick/rss/configuration/RssMvcConfiguration.java
@@ -0,0 +1,20 @@
+package com.juick.rss.configuration;
+
+import com.juick.rss.MessagesView;
+import com.juick.rss.RepliesView;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
+
+/**
+ * Created by vitalyster on 28.06.2016.
+ */
+@Configuration
+@ComponentScan(basePackages = {"com.juick.rss.controllers"})
+public class RssMvcConfiguration extends WebMvcConfigurationSupport {
+ @Override
+ protected void configureViewResolvers(ViewResolverRegistry registry) {
+ registry.enableContentNegotiation(new MessagesView(), new RepliesView());
+ }
+}