本文整理汇总了Java中org.springframework.web.servlet.view.ContentNegotiatingViewResolver.setViewResolvers方法的典型用法代码示例。如果您正苦于以下问题:Java ContentNegotiatingViewResolver.setViewResolvers方法的具体用法?Java ContentNegotiatingViewResolver.setViewResolvers怎么用?Java ContentNegotiatingViewResolver.setViewResolvers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.web.servlet.view.ContentNegotiatingViewResolver
的用法示例。
在下文中一共展示了ContentNegotiatingViewResolver.setViewResolvers方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver contentNegotiatingViewResolver() {
logger.debug("Configuring the ContentNegotiatingViewResolver");
ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setViewClass(JstlView.class);
urlBasedViewResolver.setSuffix(".html");
viewResolvers.add(urlBasedViewResolver);
viewResolver.setViewResolvers(viewResolvers);
List<View> defaultViews = new ArrayList<View>();
defaultViews.add(new MappingJackson2JsonView());
viewResolver.setDefaultViews(defaultViews);
return viewResolver;
}
示例2: viewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver viewResolver() {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
List<View> defaultViews = new ArrayList<View>();
defaultViews.add(new MappingJackson2JsonView());
resolver.setDefaultViews(defaultViews);
resolver.setOrder(0);
List<ViewResolver> viewResolvers = new ArrayList<ViewResolver>();
InternalResourceViewResolver internalResourceViewResolver = new InternalResourceViewResolver();
internalResourceViewResolver.setPrefix("/WEB-INF/view/");
internalResourceViewResolver.setSuffix(".jsp");
internalResourceViewResolver.setOrder(1);
viewResolvers.add(internalResourceViewResolver);
resolver.setViewResolvers(viewResolvers);
return resolver;
}
示例3: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver contentNegotiatingViewResolver() {
LOGGER.debug("Configuring the ContentNegotiatingViewResolver");
ContentNegotiatingViewResolver viewResolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<>();
UrlBasedViewResolver urlBasedViewResolver = new UrlBasedViewResolver();
urlBasedViewResolver.setViewClass(JstlView.class);
urlBasedViewResolver.setPrefix("/WEB-INF/pages/");
urlBasedViewResolver.setSuffix(".jsp");
viewResolvers.add(urlBasedViewResolver);
viewResolver.setViewResolvers(viewResolvers);
List<View> defaultViews = new ArrayList<>();
defaultViews.add(new MappingJackson2JsonView());
viewResolver.setDefaultViews(defaultViews);
return viewResolver;
}
示例4: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ContentNegotiatingViewResolver contentNegotiatingViewResolver() {
List<View> defaultViews = new ArrayList<>(2);
defaultViews.add(jsonCatnapSpringView());
defaultViews.add(jsonpCatnapSpringView());
List<CatnapWrappingView> catnapViews = new ArrayList<>(2);
catnapViews.add(jsonCatnapSpringView());
catnapViews.add(jsonpCatnapSpringView());
CatnapViewResolver catnapViewResolver = new CatnapViewResolver();
catnapViewResolver.setViews(catnapViews);
List<ViewResolver> viewResolvers = new ArrayList<>(1);
viewResolvers.add(catnapViewResolver);
ContentNegotiatingViewResolver cnvr = new ContentNegotiatingViewResolver();
cnvr.setContentNegotiationManager(mvcContentNegotiationManager());
cnvr.setOrder(1);
cnvr.setDefaultViews(defaultViews);
cnvr.setViewResolvers(viewResolvers);
return cnvr;
}
示例5: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver contentNegotiatingViewResolver(
ContentNegotiationManager manager) {
List< ViewResolver > resolvers = new ArrayList<ViewResolver>();
UrlBasedViewResolver viewResolver = new UrlBasedViewResolver();
viewResolver.setViewClass(TilesView.class);
resolvers.add(viewResolver);
JsonViewResolver r2 = new JsonViewResolver();
resolvers.add(r2);
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setViewResolvers(resolvers);
resolver.setContentNegotiationManager(manager);
return resolver;
}
示例6: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver contentNegotiatingViewResolver(ContentNegotiationManager manager) {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
resolver.setContentNegotiationManager(manager);
// Define all possible view resolvers
List<ViewResolver> resolvers = new ArrayList<ViewResolver>();
resolvers.add(excelViewResolver());
resolver.setViewResolvers(resolvers);
return resolver;
}
示例7: contentNegotiatingViewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver contentNegotiatingViewResolver(
ContentNegotiationManager manager) { // Esse método determina os possiveis formatos de retorno da viewResolver
List<ViewResolver> resolvers = new ArrayList<ViewResolver>();
resolvers.add(internalResourceViewResolver());
resolvers.add(new JsonViewResolver());
resolvers.add(getMarshallingXmlViewResolver());
ContentNegotiatingViewResolver resolver
= new ContentNegotiatingViewResolver();
resolver.setViewResolvers(resolvers);
resolver.setContentNegotiationManager(manager);
return resolver;
}
示例8: viewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ContentNegotiatingViewResolver viewResolver(BeanFactory beanFactory) {
ContentNegotiatingViewResolver contentNegotiatingViewResolver = new ContentNegotiatingViewResolver();
contentNegotiatingViewResolver.setContentNegotiationManager(beanFactory.getBean(ContentNegotiationManager.class));
contentNegotiatingViewResolver.setViewResolvers(Arrays.asList(pungweViewResolver()));
contentNegotiatingViewResolver.setDefaultViews(Arrays.asList(mappingJackson2JsonView()));
contentNegotiatingViewResolver.setOrder(Ordered.HIGHEST_PRECEDENCE);
return contentNegotiatingViewResolver;
}
示例9: viewResolver
import org.springframework.web.servlet.view.ContentNegotiatingViewResolver; //导入方法依赖的package包/类
@Bean
public ContentNegotiatingViewResolver viewResolver() {
ContentNegotiatingViewResolver resolver = new ContentNegotiatingViewResolver();
List<ViewResolver> viewResolvers = new ArrayList<>(1);
viewResolvers.add(jspViewResolver());
resolver.setViewResolvers(viewResolvers);
List<View> views = new ArrayList<>();
views.add(jsonView());
resolver.setDefaultViews(views);
return resolver;
}