diff --git a/src/main/java/run/halo/app/controller/content/MainController.java b/src/main/java/run/halo/app/controller/content/MainController.java index d2f6f58a4..9c31ef556 100644 --- a/src/main/java/run/halo/app/controller/content/MainController.java +++ b/src/main/java/run/halo/app/controller/content/MainController.java @@ -50,11 +50,9 @@ public class MainController { } @GetMapping("${halo.admin-path:admin}") - public void admin(HttpServletResponse response) throws IOException { - String adminIndexRedirectUri = - HaloUtils.ensureBoth(haloProperties.getAdminPath(), HaloUtils.URL_SEPARATOR) - + INDEX_REDIRECT_URI; - response.sendRedirect(adminIndexRedirectUri); + public String admin() throws IOException { + return HaloUtils.ensureBoth(haloProperties.getAdminPath(), HaloUtils.URL_SEPARATOR) + + INDEX_REDIRECT_URI; } @GetMapping("version") @@ -64,14 +62,12 @@ public class MainController { } @GetMapping("install") - public void installation(HttpServletResponse response) throws IOException { + public String installation() throws IOException { boolean isInstalled = optionService .getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false); if (!isInstalled) { - String installRedirectUri = - StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/") - + INSTALL_REDIRECT_URI; - response.sendRedirect(installRedirectUri); + return StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/") + + INSTALL_REDIRECT_URI; } else { throw new NotFoundException("404"); } @@ -103,4 +99,4 @@ public class MainController { response.sendRedirect(HaloUtils.normalizeUrl(favicon)); } } -} +} \ No newline at end of file