Class ViewControllerRegistry
- java.lang.Object
- org.springframework.web.servlet.config.annotation.ViewControllerRegistry
public class ViewControllerRegistry extends Object
Assists with the registration of simple automated controllers pre-configured with status code and/or a view.- Since:
- 3.1
- Author:
- Rossen Stoyanchev, Keith Donald
Constructor Summary
Constructors Constructor Description ViewControllerRegistry()
Deprecated.ViewControllerRegistry(ApplicationContext applicationContext)
Class constructor withApplicationContext
.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RedirectViewControllerRegistration
addRedirectViewController(String urlPath, String redirectUrl)
Map a view controller to the given URL path (or pattern) in order to redirect to another URL.void
addStatusController(String urlPath, HttpStatus 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.ViewControllerRegistration
addViewController(String urlPath)
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.protected SimpleUrlHandlerMapping
buildHandlerMapping()
Return theHandlerMapping
that contains the registered view controller mappings, ornull
for no registrations.protected AbstractHandlerMapping
getHandlerMapping()
Deprecated.as of 4.3.12, in favor ofbuildHandlerMapping()
protected void
setApplicationContext(ApplicationContext applicationContext)
Deprecated.void
setOrder(int order)
Specify the order to use for theHandlerMapping
used to map view controllers relative to other handler mappings configured in Spring MVC.
Constructor Detail
ViewControllerRegistry
public ViewControllerRegistry(ApplicationContext applicationContext)
Class constructor withApplicationContext
.- Since:
- 4.3.12
ViewControllerRegistry
@Deprecated public ViewControllerRegistry()
Deprecated.
Method Detail
addViewController
public ViewControllerRegistration addViewController(String urlPath)
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.Patterns like
"/admin/**"
or"/articles/{articlename:\\w+}"
are allowed. SeeAntPathMatcher
for more details on the syntax.
addRedirectViewController
public RedirectViewControllerRegistration addRedirectViewController(String urlPath, String redirectUrl)
Map a view controller to the given URL path (or pattern) in order to redirect to another URL. 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
addStatusController
public void addStatusController(String urlPath, HttpStatus 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.- Since:
- 4.1
setOrder
public void setOrder(int order)
Specify the order to use for theHandlerMapping
used 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.
buildHandlerMapping
protected SimpleUrlHandlerMapping buildHandlerMapping()
Return theHandlerMapping
that contains the registered view controller mappings, ornull
for no registrations.- Since:
- 4.3.12
getHandlerMapping
@Deprecated protected AbstractHandlerMapping getHandlerMapping()
Deprecated.as of 4.3.12, in favor ofbuildHandlerMapping()
setApplicationContext
@Deprecated protected void setApplicationContext(ApplicationContext applicationContext)
Deprecated.