Refine search
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/results").setViewName("results"); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("forward:/index.htm"); }
/** * Map a simple controller to the given URL path (or pattern) in order to * set the response status to the given code without rendering a body. * @since 4.1 */ public void addStatusController(String urlPath, HttpStatus statusCode) { ViewControllerRegistration registration = new ViewControllerRegistration(urlPath); registration.setApplicationContext(this.applicationContext); registration.setStatusCode(statusCode); registration.getViewController().setStatusOnly(true); this.registrations.add(registration); }
/** * Map a view controller to the given URL path (or pattern) in order to render * a response with a pre-configured status code and view. * <p>Patterns like {@code "/admin/**"} or {@code "/articles/{articlename:\\w+}"} * are allowed. See {@link org.springframework.util.AntPathMatcher} for more details on the * syntax. */ public ViewControllerRegistration addViewController(String urlPath) { ViewControllerRegistration registration = new ViewControllerRegistration(urlPath); registration.setApplicationContext(this.applicationContext); this.registrations.add(registration); return registration; }
/** * Return the {@code HandlerMapping} that contains the registered view * controller mappings, or {@code null} for no registrations. * @since 4.3.12 */ @Nullable protected SimpleUrlHandlerMapping buildHandlerMapping() { if (this.registrations.isEmpty() && this.redirectRegistrations.isEmpty()) { return null; } Map<String, Object> urlMap = new LinkedHashMap<>(); for (ViewControllerRegistration registration : this.registrations) { urlMap.put(registration.getUrlPath(), registration.getViewController()); } for (RedirectViewControllerRegistration registration : this.redirectRegistrations) { urlMap.put(registration.getUrlPath(), registration.getViewController()); } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setUrlMap(urlMap); handlerMapping.setOrder(this.order); return handlerMapping; }
@Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/ui").setViewName("redirect:ui/"); registry.addViewController("/ui/").setViewName("forward:index.html"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); //super.addViewControllers(registry); }
@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"); }
@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); }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); registry.addViewController("/access").setViewName("access"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/login").setViewName("login"); registry.addViewController("/register").setViewName("register"); registry.addRedirectViewController("/", "/home"); }
/** * Map a view controller to the given URL path (or pattern) in order to render * a response with a pre-configured status code and view. * <p>Patterns like {@code "/admin/**"} or {@code "/articles/{articlename:\\w+}"} * are allowed. See {@link org.springframework.util.AntPathMatcher} for more details on the * syntax. */ public ViewControllerRegistration addViewController(String urlPath) { ViewControllerRegistration registration = new ViewControllerRegistration(urlPath); registration.setApplicationContext(this.applicationContext); this.registrations.add(registration); return registration; }
/** * Return the {@code HandlerMapping} that contains the registered view * controller mappings, or {@code null} for no registrations. * @since 4.3.12 */ @Nullable protected SimpleUrlHandlerMapping buildHandlerMapping() { if (this.registrations.isEmpty() && this.redirectRegistrations.isEmpty()) { return null; } Map<String, Object> urlMap = new LinkedHashMap<>(); for (ViewControllerRegistration registration : this.registrations) { urlMap.put(registration.getUrlPath(), registration.getViewController()); } for (RedirectViewControllerRegistration registration : this.redirectRegistrations) { urlMap.put(registration.getUrlPath(), registration.getViewController()); } SimpleUrlHandlerMapping handlerMapping = new SimpleUrlHandlerMapping(); handlerMapping.setUrlMap(urlMap); handlerMapping.setOrder(this.order); return handlerMapping; }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); } }
@Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController(CasWebSecurityConfigurerAdapter.ENDPOINT_URL_ADMIN_FORM_LOGIN).setViewName(CasWebflowConstants.VIEW_ID_ENDPOINT_ADMIN_LOGIN_VIEW); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); } }
@Override public void addViewControllers(ViewControllerRegistry registry) { super.addViewControllers(registry); registry.addViewController("/login").setViewName("public/login"); registry.addRedirectViewController("/", "/home"); }
/** * Map a simple controller to the given URL path (or pattern) in order to * set the response status to the given code without rendering a body. * @since 4.1 */ public void addStatusController(String urlPath, HttpStatus statusCode) { ViewControllerRegistration registration = new ViewControllerRegistration(urlPath); registration.setApplicationContext(this.applicationContext); registration.setStatusCode(statusCode); registration.getViewController().setStatusOnly(true); this.registrations.add(registration); }
/** * Map a view controller to the given URL path (or pattern) in order to render * a response with a pre-configured status code and view. * <p>Patterns like {@code "/admin/**"} or {@code "/articles/{articlename:\\w+}"} * are allowed. See {@link org.springframework.util.AntPathMatcher} for more details on the * syntax. */ public ViewControllerRegistration addViewController(String urlPath) { ViewControllerRegistration registration = new ViewControllerRegistration(urlPath); registration.setApplicationContext(this.applicationContext); this.registrations.add(registration); return registration; }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/login").setViewName("login"); registry.addViewController("/oauth/confirm_access").setViewName("authorize"); } }
@Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); registry.setOrder(Ordered.HIGHEST_PRECEDENCE); }
@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"); }