当前位置: 首页>>代码示例>>Java>>正文


Java ContentNegotiatingViewResolver.setViewResolvers方法代码示例

本文整理汇总了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;
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:20,代码来源:CloudUnitApplicationContext.java

示例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;
}
 
开发者ID:EnterKey,项目名称:enterkey-framework,代码行数:20,代码来源:Application.java

示例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;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:21,代码来源:DispatcherServletConfiguration.java

示例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;
}
 
开发者ID:gregwhitaker,项目名称:catnap,代码行数:25,代码来源:DelegatingCatnapWebMvcConfiguration.java

示例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;

}
 
开发者ID:gill3s,项目名称:opentipbot,代码行数:20,代码来源:WebAppContext.java

示例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;
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:14,代码来源:AppConfig.java

示例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;
}
 
开发者ID:nailtonvieira,项目名称:pswot-cloud-java-spring-webapp,代码行数:16,代码来源:AppWebConfiguration.java

示例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;
}
 
开发者ID:thunderbird,项目名称:pungwecms,代码行数:10,代码来源:ModuleContextConfig.java

示例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;
}
 
开发者ID:srinikandula,项目名称:mybus,代码行数:12,代码来源:WebApplicationConfig.java


注:本文中的org.springframework.web.servlet.view.ContentNegotiatingViewResolver.setViewResolvers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。