Теперь генерируется вначале обобщенный KinoPlay объект, сочетающий в себе все прелести обычного фильма, сериала и сезонных сериалов. Из недоделок, сейчас коряво работает возобновение просмотра.
57 lines
1.9 KiB
Java
57 lines
1.9 KiB
Java
/*
|
|
* DmitriyMX <mail@dmitriymx.ru>
|
|
* 2017-01-04
|
|
*/
|
|
package kinosearch.webapp;
|
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.GsonBuilder;
|
|
import kinosearch.core.KinoPlay;
|
|
import kinosearch.core.SpringConfig;
|
|
import org.springframework.context.annotation.*;
|
|
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.WebMvcConfigurerAdapter;
|
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
|
import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver;
|
|
|
|
@Configuration
|
|
@EnableWebMvc
|
|
@ComponentScan
|
|
@Import(SpringConfig.class)
|
|
public class WebAppConfiguration extends WebMvcConfigurerAdapter {
|
|
@Bean
|
|
public ViewResolver viewResolver() {
|
|
FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
|
|
viewResolver.setCache(true);
|
|
viewResolver.setSuffix(".html");
|
|
return viewResolver;
|
|
}
|
|
|
|
@Bean
|
|
public FreeMarkerConfigurer freemarkerConfig() {
|
|
FreeMarkerConfigurer freeMarkerConfigurer = new FreeMarkerConfigurer();
|
|
freeMarkerConfigurer.setTemplateLoaderPath("/WEB-INF/");
|
|
return freeMarkerConfigurer;
|
|
}
|
|
|
|
@Bean
|
|
@Scope("singleton")
|
|
public Gson gson() {
|
|
return new GsonBuilder().registerTypeAdapter(KinoPlay.class, new KinoPlaySerializer()).create();
|
|
}
|
|
|
|
@Override
|
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
registry.addResourceHandler("/css/**")
|
|
.addResourceLocations("/css/");
|
|
registry.addResourceHandler("/fonts/**")
|
|
.addResourceLocations("/fonts/");
|
|
registry.addResourceHandler("/js/**")
|
|
.addResourceLocations("/js/");
|
|
registry.addResourceHandler("/*.png")
|
|
.addResourceLocations("/");
|
|
}
|
|
}
|