Class 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.

    • Method Detail

      • appIndex

        @GetMapping({"/","/login","/app","/app/","/app/**","/service/**","/admin/**"})
        public String appIndex​(javax.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/**"})
        public String localePrefixedAppIndex​(@PathVariable("locale")
                                             String locale,
                                             javax.servlet.http.HttpServletRequest request)
      • swaggerUiWelcomePage

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