类 ViewResolverRegistry
ViewResolver instances.
This class is expected to be used via WebMvcConfigurer.configureViewResolvers(cn.taketoday.web.config.ViewResolverRegistry).- 从以下版本开始:
- 4.0 2022/2/8 15:42
- 作者:
- Sebastien Deleuze, Rossen Stoyanchev, Harry Yang
-
嵌套类概要
嵌套类修饰符和类型类说明private static classprivate static classprivate static class -
字段概要
字段修饰符和类型字段说明private final cn.taketoday.context.ApplicationContextprivate ContentNegotiatingViewResolverprivate final ContentNegotiationManagerprivate Integerprivate final ArrayList<ViewResolver> -
构造器概要
构造器构造器说明ViewResolverRegistry(ContentNegotiationManager contentNegotiationManager, cn.taketoday.context.ApplicationContext context) Class constructor withContentNegotiationManagerandApplicationContext. -
方法概要
修饰符和类型方法说明voidbeanName()Register a bean name view resolver that interprets view names as the names ofViewbeans.voidenableContentNegotiation(boolean useNotAcceptableStatus, View... defaultViews) Enable use of aContentNegotiatingViewResolverto front all other configured view resolvers and select among all selected Views based on media types requested by the client (e.g. in the Accept header).voidenableContentNegotiation(View... defaultViews) Enable use of aContentNegotiatingViewResolverto front all other configured view resolvers and select among all selected Views based on media types requested by the client (e.g. in the Accept header).Register a FreeMarker view resolver with an empty default view name prefix and a default suffix of ".ftl".protected intgetOrder()protected List<ViewResolver>groovy()Register a Groovy markup view resolver with an empty default view name prefix and a default suffix of ".tpl".booleanWhether any view resolvers have been registered.private ContentNegotiatingViewResolverinitContentNegotiatingViewResolver(View[] defaultViews) jsp()Register JSP view resolver using a default view name prefix of "/WEB-INF/" and a default suffix of ".jsp".Register JSP view resolver with the specified prefix and suffix.private booleannotFoundBeanOfType(Class<?> beanType) voidorder(int order) ViewResolver's registered through this registry are encapsulated in an instance ofViewResolverCompositeand follow the order of registration.Register a script template view resolver with an empty default view name prefix and suffix.voidviewResolver(ViewResolver viewResolver) Register aViewResolverbean instance.
-
字段详细资料
-
contentNegotiationManager
-
applicationContext
@Nullable private final cn.taketoday.context.ApplicationContext applicationContext -
contentNegotiatingResolver
-
viewResolvers
-
order
-
-
构造器详细资料
-
ViewResolverRegistry
public ViewResolverRegistry(@Nullable ContentNegotiationManager contentNegotiationManager, @Nullable cn.taketoday.context.ApplicationContext context) Class constructor withContentNegotiationManagerandApplicationContext.
-
-
方法详细资料
-
hasRegistrations
public boolean hasRegistrations()Whether any view resolvers have been registered. -
enableContentNegotiation
Enable use of aContentNegotiatingViewResolverto front all other configured view resolvers and select among all selected Views based on media types requested by the client (e.g. in the Accept header).If invoked multiple times the provided default views will be added to any other default views that may have been configured already.
-
enableContentNegotiation
Enable use of aContentNegotiatingViewResolverto front all other configured view resolvers and select among all selected Views based on media types requested by the client (e.g. in the Accept header).If invoked multiple times the provided default views will be added to any other default views that may have been configured already.
-
initContentNegotiatingViewResolver
-
jsp
Register JSP view resolver using a default view name prefix of "/WEB-INF/" and a default suffix of ".jsp".When this method is invoked more than once, each call will register a new ViewResolver instance. Note that since it's not easy to determine if a JSP exists without forwarding to it, using multiple JSP-based view resolvers only makes sense in combination with the "viewNames" property on the resolver indicating which view names are handled by which resolver.
-
jsp
Register JSP view resolver with the specified prefix and suffix.When this method is invoked more than once, each call will register a new ViewResolver instance. Note that since it's not easy to determine if a JSP exists without forwarding to it, using multiple JSP-based view resolvers only makes sense in combination with the "viewNames" property on the resolver indicating which view names are handled by which resolver.
-
freeMarker
Register a FreeMarker view resolver with an empty default view name prefix and a default suffix of ".ftl".Note that you must also configure FreeMarker by adding a
FreeMarkerConfigurerbean. -
groovy
Register a Groovy markup view resolver with an empty default view name prefix and a default suffix of ".tpl". -
scriptTemplate
Register a script template view resolver with an empty default view name prefix and suffix. -
beanName
public void beanName()Register a bean name view resolver that interprets view names as the names ofViewbeans. -
viewResolver
Register aViewResolverbean instance. This may be useful to configure a custom (or 3rd party) resolver implementation. It may also be used as an alternative to other registration methods in this class when they don't expose some more advanced property that needs to be set. -
order
public void order(int order) ViewResolver's registered through this registry are encapsulated in an instance ofViewResolverCompositeand follow the order of registration. This property determines the order of the ViewResolverComposite itself relative to any additional ViewResolver's (not registered here) present in the Framework configurationBy default this property is not set, which means the resolver is ordered at
Ordered.LOWEST_PRECEDENCEunless content negotiation is enabled in which case the order (if not set explicitly) is changed toOrdered.HIGHEST_PRECEDENCE. -
notFoundBeanOfType
-
getOrder
protected int getOrder() -
getViewResolvers
-