public class ViewResolverRegistry
extends java.lang.Object
ViewResolver
instances.
This class is expected to be used via WebMvcConfigurer.configureViewResolvers(org.springframework.web.servlet.config.annotation.ViewResolverRegistry)
.Modifier and Type | Class and Description |
---|---|
private static class |
ViewResolverRegistry.FreeMarkerRegistration |
private static class |
ViewResolverRegistry.GroovyMarkupRegistration |
private static class |
ViewResolverRegistry.TilesRegistration |
private static class |
ViewResolverRegistry.VelocityRegistration |
Modifier and Type | Field and Description |
---|---|
private ApplicationContext |
applicationContext |
private ContentNegotiatingViewResolver |
contentNegotiatingResolver |
private ContentNegotiationManager |
contentNegotiationManager |
private int |
order |
private java.util.List<ViewResolver> |
viewResolvers |
Constructor and Description |
---|
ViewResolverRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
beanName()
Register a bean name view resolver that interprets view names as the names
of
View beans. |
void |
enableContentNegotiation(boolean useNotAcceptableStatus,
View... defaultViews)
Enable use of a
ContentNegotiatingViewResolver to front all other
configured view resolvers and select among all selected Views based on
media types requested by the client (e.g. |
void |
enableContentNegotiation(View... defaultViews)
Enable use of a
ContentNegotiatingViewResolver to front all other
configured view resolvers and select among all selected Views based on
media types requested by the client (e.g. |
UrlBasedViewResolverRegistration |
freeMarker()
Register a FreeMarker view resolver with an empty default view name
prefix and a default suffix of ".ftl".
|
protected int |
getOrder() |
protected java.util.List<ViewResolver> |
getViewResolvers() |
UrlBasedViewResolverRegistration |
groovy()
Register a Groovy markup view resolver with an empty default view name
prefix and a default suffix of ".tpl".
|
protected boolean |
hasBeanOfType(java.lang.Class<?> beanType) |
boolean |
hasRegistrations()
Whether any view resolvers have been registered.
|
private void |
initContentNegotiatingViewResolver(View[] defaultViews) |
UrlBasedViewResolverRegistration |
jsp()
Register JSP view resolver using a default view name prefix of "/WEB-INF/"
and a default suffix of ".jsp".
|
UrlBasedViewResolverRegistration |
jsp(java.lang.String prefix,
java.lang.String suffix)
Register JSP view resolver with the specified prefix and suffix.
|
protected void |
setApplicationContext(ApplicationContext applicationContext) |
protected void |
setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager) |
UrlBasedViewResolverRegistration |
tiles()
Register Tiles 3.x view resolver.
|
UrlBasedViewResolverRegistration |
velocity()
Register Velocity view resolver with an empty default view name
prefix and a default suffix of ".vm".
|
void |
viewResolver(ViewResolver viewResolver)
Register a
ViewResolver bean instance. |
private ContentNegotiatingViewResolver contentNegotiatingResolver
private final java.util.List<ViewResolver> viewResolvers
private int order
private ContentNegotiationManager contentNegotiationManager
private ApplicationContext applicationContext
protected void setContentNegotiationManager(ContentNegotiationManager contentNegotiationManager)
protected void setApplicationContext(ApplicationContext applicationContext)
public boolean hasRegistrations()
public void enableContentNegotiation(View... defaultViews)
ContentNegotiatingViewResolver
to 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.
public void enableContentNegotiation(boolean useNotAcceptableStatus, View... defaultViews)
ContentNegotiatingViewResolver
to 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.
private void initContentNegotiatingViewResolver(View[] defaultViews)
public UrlBasedViewResolverRegistration 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.
public UrlBasedViewResolverRegistration jsp(java.lang.String prefix, java.lang.String 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.
public UrlBasedViewResolverRegistration tiles()
Note that you must also configure Tiles by adding a
TilesConfigurer
bean.
public UrlBasedViewResolverRegistration freeMarker()
Note that you must also configure FreeMarker by adding a
FreeMarkerConfigurer
bean.
public UrlBasedViewResolverRegistration velocity()
Note that you must also configure Velocity by adding a
VelocityConfigurer
bean.
public UrlBasedViewResolverRegistration groovy()
public void beanName()
View
beans.public void viewResolver(ViewResolver viewResolver)
ViewResolver
bean 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.protected boolean hasBeanOfType(java.lang.Class<?> beanType)
protected int getOrder()
protected java.util.List<ViewResolver> getViewResolvers()