Class ViewControllerRegistry
- Since:
- 3.1
- Author:
- Rossen Stoyanchev, Keith Donald
- 
Constructor SummaryConstructorsConstructorDescriptionViewControllerRegistry(ApplicationContext applicationContext) Class constructor withApplicationContext.
- 
Method SummaryModifier and TypeMethodDescriptionaddRedirectViewController(String urlPath, String redirectUrl) Map a view controller to the given URL path or pattern in order to redirect to another URL.voidaddStatusController(String urlPath, HttpStatusCode statusCode) 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.addViewController(String urlPathOrPattern) Map a URL path or pattern to a view controller to render a response with the configured status code and view.protected SimpleUrlHandlerMappingReturn theHandlerMappingthat contains the registered view controller mappings, ornullfor no registrations.voidsetOrder(int order) Specify the order to use for theHandlerMappingused to map view controllers relative to other handler mappings configured in Spring MVC.
- 
Constructor Details- 
ViewControllerRegistryClass constructor withApplicationContext.- Since:
- 4.3.12
 
 
- 
- 
Method Details- 
addViewControllerMap a URL path or pattern to a view controller to render a response with the configured status code and view.Patterns such as "/admin/**"or"/articles/{articlename:\\w+}"are supported. For pattern syntax seePathPatternwhen parsed patterns areenabledorAntPathMatcherotherwise. The syntax is largely the same withPathPatternmore tailored for web usage and more efficient.Note: If an @RequestMappingmethod is mapped to a URL for any HTTP method then a view controller cannot handle the same URL. For this reason it is recommended to avoid splitting URL handling across an annotated controller and a view controller.
- 
addRedirectViewControllerpublic RedirectViewControllerRegistration addRedirectViewController(String urlPath, String redirectUrl) Map a view controller to the given URL path or pattern in order to redirect to another URL.For pattern syntax see PathPatternwhen parsed patterns areenabledorAntPathMatcherotherwise. The syntax is largely the same withPathPatternmore tailored for web usage and more efficient.By default the redirect URL is expected to be relative to the current ServletContext, i.e. as relative to the web application root. - Since:
- 4.1
 
- 
addStatusControllerMap 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.For pattern syntax see PathPatternwhen parsed patterns areenabledorAntPathMatcherotherwise. The syntax is largely the same withPathPatternmore tailored for web usage and more efficient.- Since:
- 4.1
 
- 
setOrderpublic void setOrder(int order) Specify the order to use for theHandlerMappingused to map view controllers relative to other handler mappings configured in Spring MVC.By default this is set to 1, i.e. right after annotated controllers, which are ordered at 0. 
- 
buildHandlerMappingReturn theHandlerMappingthat contains the registered view controller mappings, ornullfor no registrations.- Since:
- 4.3.12
 
 
-