Skip to content
Snippets Groups Projects
Commit 7896b8b8 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

"/" is mapped as "/index.xhtml"

parent c9e395bd
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!547Resolve "index.xhtml should be a symlink to /"
Pipeline #7956 passed
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment