當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。