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


Java InternalResourceViewResolver.setSuffix方法代码示例

本文整理汇总了Java中org.springframework.web.servlet.view.InternalResourceViewResolver.setSuffix方法的典型用法代码示例。如果您正苦于以下问题:Java InternalResourceViewResolver.setSuffix方法的具体用法?Java InternalResourceViewResolver.setSuffix怎么用?Java InternalResourceViewResolver.setSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.web.servlet.view.InternalResourceViewResolver的用法示例。


在下文中一共展示了InternalResourceViewResolver.setSuffix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
private ViewResolver getViewResolver()
{
	InternalResourceViewResolver viewResolver = new InternalResourceViewResolver()
	{
		@Override
		protected AbstractUrlBasedView buildView(String viewName) throws Exception
		{
			String suffix = getSuffix();
			if (suffix != null && suffix.length() > 0 && viewName.endsWith(suffix))
			{
				viewName = viewName.substring(0, viewName.length() - suffix.length());
			}

			return super.buildView(viewName);
		}
	};
	viewResolver.setPrefix("/");
	viewResolver.setSuffix("");
	return viewResolver;
}
 
开发者ID:tmply,项目名称:tmply,代码行数:21,代码来源:WebMvcConfig.java

示例2: setupViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public InternalResourceViewResolver setupViewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/");
    resolver.setSuffix(".jsp");
    resolver.setContentType("text/html; charset-utf-8");
    resolver.setViewClass(JstlView.class);
    return resolver;
}
 
开发者ID:andrsam,项目名称:bookshelf,代码行数:10,代码来源:WebConfig.java

示例3: withNoViewAndSamePath

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Test
public void withNoViewAndSamePath() throws Exception {
	InternalResourceViewResolver vr = (InternalResourceViewResolver) complexDispatcherServlet
			.getWebApplicationContext().getBean("viewResolver2");
	vr.setSuffix("");

	MockServletContext servletContext = new MockServletContext();
	MockHttpServletRequest request = new MockHttpServletRequest(servletContext, "GET", "/noview");
	MockHttpServletResponse response = new MockHttpServletResponse();

	try {
		complexDispatcherServlet.service(request, response);
		fail("Should have thrown ServletException");
	}
	catch (ServletException ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:DispatcherServletTests.java

示例4: testWithNoViewAndSamePath

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
public void testWithNoViewAndSamePath() throws Exception {
	InternalResourceViewResolver vr = (InternalResourceViewResolver) complexDispatcherServlet
			.getWebApplicationContext().getBean("viewResolver2");
	vr.setSuffix("");

	MockServletContext servletContext = new MockServletContext();
	MockHttpServletRequest request = new MockHttpServletRequest(servletContext, "GET", "/noview");
	MockHttpServletResponse response = new MockHttpServletResponse();

	try {
		complexDispatcherServlet.service(request, response);
		fail("Should have thrown ServletException");
	}
	catch (ServletException ex) {
		ex.printStackTrace();
	}
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:18,代码来源:DispatcherServletTests.java

示例5: configureInternalResourceViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public InternalResourceViewResolver configureInternalResourceViewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    return resolver;
}
 
开发者ID:cloudbees-attic,项目名称:spring-load-time-weaving-clickstart,代码行数:8,代码来源:WebConfig.java

示例6: jspViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public InternalResourceViewResolver jspViewResolver() {
    InternalResourceViewResolver viewResolverA = new InternalResourceViewResolver();
    viewResolverA.setPrefix("/WEB-INF/jsp/");
    viewResolverA.setSuffix(".jsp");
    viewResolverA.setOrder(1);
    return viewResolverA;
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:9,代码来源:SpringDispatcherConfig.java

示例7: viewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver viewResolver() {
    final InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setViewClass(JstlView.class);
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    return resolver;
}
 
开发者ID:cerner,项目名称:jwala,代码行数:9,代码来源:ApacheEnterpriseManagerWebConfig.java

示例8: configureViewResolvers

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
    super.configureViewResolvers(registry);
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setPrefix("/pages/");
    viewResolver.setSuffix(".jsp");
    registry.viewResolver(viewResolver);
}
 
开发者ID:SkywalkingTest,项目名称:Agent-Benchmarks,代码行数:9,代码来源:ApplicationConfigAdapter.java

示例9: viewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    resolver.setExposeContextBeansAsAttributes(true);
    return resolver;
}
 
开发者ID:Ulyssesss,项目名称:java-demo,代码行数:9,代码来源:WebConfig.java

示例10: viewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
/**
 * 配置jsp视图解析器
 *
 * @return InternalResourceViewResolver view resolver
 */
@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    return resolver;
}
 
开发者ID:numsg,项目名称:spring-boot-seed,代码行数:13,代码来源:WebConfig.java

示例11: getViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public InternalResourceViewResolver getViewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/");
    resolver.setSuffix(".html");
    resolver.setOrder(3);
    return resolver;
}
 
开发者ID:PacktPublishing,项目名称:Spring-5.0-Cookbook,代码行数:9,代码来源:SpringMvcConfig.java

示例12: configureInternalResourceViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
/**
 * Basic setup for JSP views.
 */
@Bean
public InternalResourceViewResolver configureInternalResourceViewResolver() {
    InternalResourceViewResolver resolver =
            new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/jsp/");
    resolver.setSuffix(".jsp");
    return resolver;
}
 
开发者ID:opentracing-contrib,项目名称:java-spring-web,代码行数:12,代码来源:SpringMVCConfiguration.java

示例13: configureViewResolvers

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
/**
    * Configure ViewResolvers to deliver preferred views.
    */
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {

	InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
	viewResolver.setViewClass(JstlView.class);
	viewResolver.setPrefix("/WEB-INF/views/");
	viewResolver.setSuffix(".jsp");
	registry.viewResolver(viewResolver);
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:13,代码来源:AppConfig.java

示例14: viewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");

    return resolver;
}
 
开发者ID:brainysoon,项目名称:superhouse,代码行数:9,代码来源:WebConfig.java

示例15: setupViewResolver

import org.springframework.web.servlet.view.InternalResourceViewResolver; //导入方法依赖的package包/类
@Bean
public InternalResourceViewResolver setupViewResolver(){
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix("/WEB-INF/views/");
    resolver.setSuffix(".jsp");
    return resolver;
}
 
开发者ID:biblelamp,项目名称:JavaEE,代码行数:8,代码来源:DispatcherServletConfig.java


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