package ca.corefacility.bioinformatics.irida.web.controller.thymeleaf;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * The Thymeleaf portion of the web project is powered by an AngularJS single-page application. This controller is
 * responsible for only responding with a Thymeleaf index page, then the AngularJS application takes over and queries
 * the server for resources using the REST api.
 */
@Controller
@RequestMapping("/**")
public class RootController {
    @RequestMapping
    public String getRoot() {
        return "index";
    }
}

package ca.corefacility.bioinformatics.irida.web.controller.thymeleaf;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * The Thymeleaf portion of the web project is powered by an AngularJS single-page application. This controller is
 * responsible for only responding with a Thymeleaf index page, then the AngularJS application takes over and queries
 * the server for resources using the REST api.
 */
@Controller
public class RootController {
    private static final Logger logger = LoggerFactory.getLogger(RootController.class);

    /**
     * Get the index for any request that does not contain the string "css", "js",
     * or "font" for thymeleaf to render.
     * @return the name of the index page
     */
    @RequestMapping(value = {"{path:(?!css|js|font).*$}", "{path:(?!css|js|font).*$}/**", "/"})
    public String getRoot() {
        logger.debug("Loading index.");
        return "index";
    }
}

Load the index page for *all* requests (except those that should be handled as resources by spring).
Load the index page for *all* requests (except those that should be handled as resources by spring).
