X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FHtml5PathsController.java;h=5d805381e01e133704bf4968b49f9c4e1d331155;hb=592ce20ec359928373de2e7f06214c8f8ad73c20;hp=7fb6e67428493476864b6adf95dd1ce07f8ce513;hpb=1bcbf004b19e8486718550cddd7ae0d41561dd39;p=nonrtric.git diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/Html5PathsController.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/Html5PathsController.java index 7fb6e674..5d805381 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/Html5PathsController.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/Html5PathsController.java @@ -8,9 +8,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -39,30 +39,31 @@ import org.springframework.web.bind.annotation.RequestMethod; @Controller public class Html5PathsController { - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - /** - * Forwards the browser to the index (main) page upon request of a known route. - * This unfortunately requires duplication of the Angular route strings in the - * path mappings on this method. Could switch to a regex pattern instead someday - * if the routes change too often. - * - * https://stackoverflow.com/questions/44692781/configure-spring-boot-to-redirect-404-to-a-single-page-app - * - * @param request - * HttpServletRequest - * @param response - * HttpServletResponse - * @throws IOException - * On error - */ - @RequestMapping(method = { RequestMethod.OPTIONS, RequestMethod.GET }, // - path = { "/policy", "/user" }) - public void forwardAngularRoutes(HttpServletRequest request, HttpServletResponse response) throws IOException { - URL url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "/index.html"); - if (logger.isDebugEnabled()) - logger.debug("forwardAngularRoutes: {} redirected to {}", request.getRequestURI(), url); - response.sendRedirect(url.toString()); - } + /** + * Forwards the browser to the index (main) page upon request of a known route. + * This unfortunately requires duplication of the Angular route strings in the + * path mappings on this method. Could switch to a regex pattern instead someday + * if the routes change too often. + * + * https://stackoverflow.com/questions/44692781/configure-spring-boot-to-redirect-404-to-a-single-page-app + * + * @param request + * HttpServletRequest + * @param response + * HttpServletResponse + * @throws IOException + * On error + */ + @RequestMapping( + method = {RequestMethod.OPTIONS, RequestMethod.GET}, // + path = {"/policy", "/user"}) + public void forwardAngularRoutes(HttpServletRequest request, HttpServletResponse response) throws IOException { + URL url = new URL(request.getScheme(), request.getServerName(), request.getServerPort(), "/index.html"); + if (logger.isDebugEnabled()) + logger.debug("forwardAngularRoutes: {} redirected to {}", request.getRequestURI(), url); + response.sendRedirect(url.toString()); + } }