Commit 5b67811f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '619-index-xhtml-should-be-a-symlink-to' into 'master'

Resolve "index.xhtml should be a symlink to /"

Closes #619

See merge request minerva/core!547
parents c9e395bd 7896b8b8
......@@ -12,11 +12,6 @@ import org.springframework.web.servlet.config.annotation.*;
@ComponentScan(basePackages = {"lcsb.mapviewer.web"})
public class SpringWebConfig extends WebMvcConfigurerAdapter {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("/index.xhtml");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
......
......@@ -128,6 +128,19 @@ public class WebAppInitializer implements WebApplicationInitializer {
restApiDispatcher.setLoadOnStartup(1);
restApiDispatcher.addMapping("/api/*");
/*
* ================ WEB CONTEXT ================
*/
AnnotationConfigWebApplicationContext webContext = new AnnotationConfigWebApplicationContext();
webContext.setParent(rootContext);
webContext.register(SpringWebConfig.class);
ServletRegistration.Dynamic webDispatcher = container.addServlet("WEB Servlet",
new DispatcherServlet(webContext));
webDispatcher.setLoadOnStartup(1);
webDispatcher.addMapping("/");
/*
* ======= FILTERS =======
*/
......
package lcsb.mapviewer.web.controler;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/")
public class RootController {
/**
* Default class logger.
*/
private Logger logger = Logger.getLogger(RootController.class);
@RequestMapping(value = "/", method = { RequestMethod.GET, RequestMethod.POST })
public ModelAndView rootPage(ModelMap model) {
logger.debug("Accessing root page");
return new ModelAndView("/index.xhtml", model);
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment