类 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.- 从以下版本开始:
- 3.1
- 作者:
- Rossen Stoyanchev, Keith Donald
构造器概要
构造器 构造器 说明 ViewControllerRegistry()已过时。ViewControllerRegistry(ApplicationContext applicationContext)Class constructor withApplicationContext.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 RedirectViewControllerRegistrationaddRedirectViewController(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, 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.ViewControllerRegistrationaddViewController(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 SimpleUrlHandlerMappingbuildHandlerMapping()Return theHandlerMappingthat contains the registered view controller mappings, ornullfor no registrations.protected AbstractHandlerMappinggetHandlerMapping()已过时。as of 4.3.12, in favor ofbuildHandlerMapping()protected voidsetApplicationContext(ApplicationContext applicationContext)已过时。voidsetOrder(int order)Specify the order to use for theHandlerMappingused to map view controllers relative to other handler mappings configured in Spring MVC.
构造器详细资料
ViewControllerRegistry
public ViewControllerRegistry(ApplicationContext applicationContext)
Class constructor withApplicationContext.- 从以下版本开始:
- 4.3.12
ViewControllerRegistry
@Deprecated public ViewControllerRegistry()
已过时。
方法详细资料
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. SeeAntPathMatcherfor 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.- 从以下版本开始:
- 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.- 从以下版本开始:
- 4.1
setOrder
public 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.
buildHandlerMapping
protected SimpleUrlHandlerMapping buildHandlerMapping()
Return theHandlerMappingthat contains the registered view controller mappings, ornullfor no registrations.- 从以下版本开始:
- 4.3.12
getHandlerMapping
@Deprecated protected AbstractHandlerMapping getHandlerMapping()
已过时。as of 4.3.12, in favor ofbuildHandlerMapping()
setApplicationContext
@Deprecated protected void setApplicationContext(ApplicationContext applicationContext)
已过时。