public class ViewControllerRegistry
extends java.lang.Object
Constructor and Description |
---|
ViewControllerRegistry(ApplicationContext applicationContext)
Class constructor with
ApplicationContext . |
Modifier and Type | Method and Description |
---|---|
RedirectViewControllerRegistration |
addRedirectViewController(java.lang.String urlPath,
java.lang.String redirectUrl)
Map a view controller to the given URL path (or pattern) in order to redirect
to another URL.
|
void |
addStatusController(java.lang.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(java.lang.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 the
HandlerMapping that contains the registered view
controller mappings, or null for no registrations. |
void |
setOrder(int order)
Specify the order to use for the
HandlerMapping used to map view
controllers relative to other handler mappings configured in Spring MVC. |
public ViewControllerRegistry(@Nullable ApplicationContext applicationContext)
ApplicationContext
.public ViewControllerRegistration addViewController(java.lang.String urlPath)
Patterns like "/admin/**"
or "/articles/{articlename:\\w+}"
are allowed. See AntPathMatcher
for more details on the
syntax.
public RedirectViewControllerRegistration addRedirectViewController(java.lang.String urlPath, java.lang.String redirectUrl)
public void addStatusController(java.lang.String urlPath, HttpStatus statusCode)
public void setOrder(int order)
HandlerMapping
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.
@Nullable protected SimpleUrlHandlerMapping buildHandlerMapping()
HandlerMapping
that contains the registered view
controller mappings, or null
for no registrations.