Class FrontController

java.lang.Object
org.tailormap.api.configuration.base.FrontController

@Controller public class FrontController extends Object
Front controller which forwards requests to URLs created by the Angular routing module to the proper viewer or admin index.html of the Angular bundle, for example when the user refreshes the page. Unfortunately, a proper front controller would first check if the file which the requested URL maps to exists and only return the index.html file if it doesn't. That is quite complicated to do in Spring Boot so as a poor-mans alternative we explicitly match the specific router URLs navigated to by the Angular frontends which don't map to files from the bundle.

It could happen that a frontend developer adds a route and forgets to update this front controller, and it is only noticed later when someone presses F5 and gets a 404.

  • Constructor Details

  • Method Details

    • appIndex

      @GetMapping({"/","/login","/app","/app/","/app/**","/service/**","/admin/**","/ext/**"}) public String appIndex(jakarta.servlet.http.HttpServletRequest request)
    • localePrefixedAppIndex

      @GetMapping({"/{locale}/","/{locale}/login","/{locale:^(?!api)[a-zA-Z-]+}/app/**","/{locale:^(?!api)[a-zA-Z-]+}/service/**","/{locale:^(?!api)[a-zA-Z-]+}/admin/**","/{locale:^(?!api)[a-zA-Z-]+}/ext/**"}) public String localePrefixedAppIndex(@PathVariable("locale") String locale, jakarta.servlet.http.HttpServletRequest request)
    • swaggerUiWelcomePage

      @GetMapping({"/swagger-ui","/swagger-ui/"}) public String swaggerUiWelcomePage()