@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/info", "/actuator/info"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/path").setViewName("view"); registry.addRedirectViewController("/old", "/new").setStatusCode(HttpStatus.PERMANENT_REDIRECT); registry.addStatusController("/bad", HttpStatus.NOT_FOUND); }
@Test public void addRedirectViewController() throws Exception { this.registry.addRedirectViewController("/path", "/redirectTo"); RedirectView redirectView = getRedirectView("/path"); this.request.setQueryString("a=b"); this.request.setContextPath("/context"); redirectView.render(Collections.emptyMap(), this.request, this.response); assertEquals(302, this.response.getStatus()); assertEquals("/context/redirectTo", this.response.getRedirectedUrl()); assertNotNull(redirectView.getApplicationContext()); }
@Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/my/path/", "/my/path") .setKeepQueryParams(true) .setStatusCode(HttpStatus.PERMANENT_REDIRECT); }
@Test public void addRedirectViewControllerWithCustomSettings() throws Exception { this.registry.addRedirectViewController("/path", "/redirectTo") .setContextRelative(false) .setKeepQueryParams(true) .setStatusCode(HttpStatus.PERMANENT_REDIRECT); RedirectView redirectView = getRedirectView("/path"); this.request.setQueryString("a=b"); this.request.setContextPath("/context"); redirectView.render(Collections.emptyMap(), this.request, this.response); assertEquals(308, this.response.getStatus()); assertEquals("/redirectTo?a=b", response.getRedirectedUrl()); assertNotNull(redirectView.getApplicationContext()); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/prometheus", "/actuator/prometheus"); } }
@Override public void addViewControllers(ViewControllerRegistry registry) { // registry.addRedirectViewController("/", "redirect:/admin/index"); registry.addRedirectViewController("/", "/index"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT + "/v2/api-docs", "/v2/api-docs"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT + "/configuration/ui", "/configuration/ui"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT +"/configuration/security", "/configuration/security"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT +"/swagger-resources", "/swagger-resources"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT, "/swagger-ui.html"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT + "/v2/api-docs", "/v2/api-docs"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT + "/configuration/ui", "/configuration/ui"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT +"/configuration/security", "/configuration/security"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT +"/swagger-resources", "/swagger-resources"); registry.addRedirectViewController(ApiConstants.API_DOCS_ROOT, "/swagger-ui.html"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/info", "/actuator/info"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("oldpath","newpath").setStatusCode(HttpStatus.MOVED_PERMANENTLY); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/swagger", "/swagger-ui.html"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addRedirectViewController("/**/favicon.ico", "/assets/images/_favicon.ico"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { if (isIndexRedirectEnabled) { registry.addRedirectViewController("/", "/app/"); } super.addViewControllers(registry); }
@Override public void addViewControllers(ViewControllerRegistry registry) { if (properties.getWebapp().isIndexRedirectEnabled()) { registry.addRedirectViewController("/", "/app/"); } }
@Override public void addViewControllers(ViewControllerRegistry registry) { if (properties.getWebapp().isIndexRedirectEnabled()) { registry.addRedirectViewController("/", "/app/"); } }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/login").setViewName("public/login"); registry.addRedirectViewController("/", "/home"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { String contextPath = adminServerProperties.getContextPath(); if (StringUtils.hasText(contextPath)) { registry.addRedirectViewController(contextPath, server.getPath(contextPath) + "/"); } registry.addViewController(contextPath + "/").setViewName("forward:index.html"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/login").setViewName("login"); registry.addViewController("/register").setViewName("register"); registry.addRedirectViewController("/", "/home"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addRedirectViewController("/", "/home"); registry.addViewController("/home").setViewName("home"); registry.addViewController("/login").setViewName("login"); registry.addViewController("/error/forbidden").setViewName("error/forbidden"); registry.addViewController("/error/notFound").setViewName("error/notFound"); registry.addViewController("/my/main").setViewName("my/myMain"); registry.addViewController("/admin/main").setViewName("admin/adminMain"); registry.addViewController("/loggedOut").setViewName("loggedOut"); }