public class ViewResolverRegistry extends Object
ViewResolver
's supporting
different template mechanisms.
In addition, you can also configure defaultViews
for rendering according to the requested content type, e.g.
JSON, XML, etc.
Constructor and Description |
---|
ViewResolverRegistry(ApplicationContext applicationContext) |
Modifier and Type | Method and Description |
---|---|
void |
defaultViews(View... defaultViews)
Set default views associated with any view name and selected based on the
best match for the requested content type.
|
UrlBasedViewResolverRegistration |
freeMarker()
Register a
FreeMarkerViewResolver with a ".ftl" suffix. |
protected List<View> |
getDefaultViews() |
protected int |
getOrder() |
protected List<ViewResolver> |
getViewResolvers() |
boolean |
hasRegistrations()
Whether any view resolvers have been registered.
|
void |
order(int order)
Set the order for the
ViewResolutionResultHandler . |
UrlBasedViewResolverRegistration |
scriptTemplate()
Register a script template view resolver with an empty default view name prefix and suffix.
|
void |
viewResolver(ViewResolver viewResolver)
Register a
ViewResolver bean instance. |
public ViewResolverRegistry(@Nullable ApplicationContext applicationContext)
public UrlBasedViewResolverRegistration freeMarker()
FreeMarkerViewResolver
with a ".ftl" suffix.
Note that you must also configure FreeMarker by
adding a FreeMarkerConfigurer
bean.
public UrlBasedViewResolverRegistration scriptTemplate()
Note that you must also configure script templating by
adding a ScriptTemplateConfigurer
bean.
public void viewResolver(ViewResolver viewResolver)
ViewResolver
bean instance. This may be useful to
configure a 3rd party resolver implementation or as an alternative to
other registration methods in this class when they don't expose some
more advanced property that needs to be set.public void defaultViews(View... defaultViews)
Use HttpMessageWriterView
to adapt and use any existing
HttpMessageWriter
(e.g. JSON, XML) as a View
.
public boolean hasRegistrations()
public void order(int order)
ViewResolutionResultHandler
.
By default this property is not set, which means the result handler is
ordered at Ordered.LOWEST_PRECEDENCE
.
protected int getOrder()
protected List<ViewResolver> getViewResolvers()