Search in sources :

Example 31 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project shiro by apache.

the class JspViewsConfig method jnlpViewResolver.

@Bean
@Order(0)
public ViewResolver jnlpViewResolver() {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setViewClass(JstlView.class);
    resolver.setPrefix("/WEB-INF/jnlp/");
    resolver.setSuffix(".jsp");
    return resolver;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Order(org.springframework.core.annotation.Order) Bean(org.springframework.context.annotation.Bean)

Example 32 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project PublicCMS-preview by sanluan.

the class AdminConfig method jspViewResolver.

/**
 * 视图层解析器,SpringBoot不支持jsp的加载路径
 *
 * @return jsp view resolver
 */
@Bean
public ViewResolver jspViewResolver() {
    InternalResourceViewResolver bean = new InternalResourceViewResolver();
    bean.setOrder(1);
    bean.setPrefix("/WEB-INF/jsp/");
    bean.setSuffix(".jsp");
    bean.setContentType("text/html;charset=UTF-8");
    cacheComponent.registerCachingViewResolverList(bean);
    return bean;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 33 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project osms by malikov-yurii.

the class SpringMvc method configureViewResolver.

@Bean
public ViewResolver configureViewResolver() {
    InternalResourceViewResolver viewResolve = new InternalResourceViewResolver();
    viewResolve.setPrefix("");
    viewResolve.setSuffix("");
    return viewResolve;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 34 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project spring-framework by spring-projects.

the class ViewResolverRegistry method jsp.

/**
 * Register JSP view resolver with the specified prefix and suffix.
 * <p>When this method is invoked more than once, each call will register a
 * new ViewResolver instance. Note that since it's not easy to determine
 * if a JSP exists without forwarding to it, using multiple JSP-based view
 * resolvers only makes sense in combination with the "viewNames" property
 * on the resolver indicating which view names are handled by which resolver.
 */
public UrlBasedViewResolverRegistration jsp(String prefix, String suffix) {
    InternalResourceViewResolver resolver = new InternalResourceViewResolver();
    resolver.setPrefix(prefix);
    resolver.setSuffix(suffix);
    this.viewResolvers.add(resolver);
    return new UrlBasedViewResolverRegistration(resolver);
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver)

Example 35 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project spring-framework by spring-projects.

the class ViewResolverRegistryTests method jspDefaultValues.

@Test
public void jspDefaultValues() {
    this.registry.jsp();
    InternalResourceViewResolver resolver = checkAndGetResolver(InternalResourceViewResolver.class);
    checkPropertyValues(resolver, "prefix", "/WEB-INF/", "suffix", ".jsp");
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Test(org.junit.jupiter.api.Test)

Aggregations

InternalResourceViewResolver (org.springframework.web.servlet.view.InternalResourceViewResolver)65 Bean (org.springframework.context.annotation.Bean)47 Test (org.junit.jupiter.api.Test)8 ContentNegotiatingViewResolver (org.springframework.web.servlet.view.ContentNegotiatingViewResolver)5 ArrayList (java.util.ArrayList)4 MappingJackson2JsonView (org.springframework.web.servlet.view.json.MappingJackson2JsonView)4 Test (org.junit.Test)3 Jaxb2Marshaller (org.springframework.oxm.jaxb.Jaxb2Marshaller)3 ContentNegotiationManager (org.springframework.web.accept.ContentNegotiationManager)3 FixedContentNegotiationStrategy (org.springframework.web.accept.FixedContentNegotiationStrategy)3 HeaderContentNegotiationStrategy (org.springframework.web.accept.HeaderContentNegotiationStrategy)3 View (org.springframework.web.servlet.View)3 MarshallingView (org.springframework.web.servlet.view.xml.MarshallingView)3 Before (org.junit.Before)2 Order (org.springframework.core.annotation.Order)2 WebTestClient (org.springframework.test.web.reactive.server.WebTestClient)2 MockMvc (org.springframework.test.web.servlet.MockMvc)2 MockMvcWebTestClient (org.springframework.test.web.servlet.client.MockMvcWebTestClient)2 ContentNegotiationManagerFactoryBean (org.springframework.web.accept.ContentNegotiationManagerFactoryBean)2 ViewResolverComposite (org.springframework.web.servlet.view.ViewResolverComposite)2