Search in sources :

Example 46 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project tutorials by eugenp.

the class NormalWebAppConfig method viewResolver.

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

Example 47 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project tutorials by eugenp.

the class WebConfig method viewResolver.

@Bean
public ViewResolver viewResolver() {
    InternalResourceViewResolver bean = new InternalResourceViewResolver();
    bean.setPrefix("/WEB-INF/");
    bean.setSuffix(".jsp");
    return bean;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 48 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project tutorials by eugenp.

the class SpringWebConfig method viewResolver.

@Bean
public InternalResourceViewResolver viewResolver() {
    InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
    viewResolver.setViewClass(JstlView.class);
    viewResolver.setPrefix("/WEB-INF/views/jsp/");
    viewResolver.setSuffix(".jsp");
    return viewResolver;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 49 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project tutorials by eugenp.

the class ApplicationConfiguration method viewResolver.

@Bean
public ContentNegotiatingViewResolver viewResolver(ContentNegotiationManager cnManager) {
    ContentNegotiatingViewResolver cnvResolver = new ContentNegotiatingViewResolver();
    cnvResolver.setContentNegotiationManager(cnManager);
    List<ViewResolver> resolvers = new ArrayList<>();
    InternalResourceViewResolver bean = new InternalResourceViewResolver("/WEB-INF/views/", ".jsp");
    ArticleRssFeedViewResolver articleRssFeedViewResolver = new ArticleRssFeedViewResolver();
    resolvers.add(bean);
    resolvers.add(articleRssFeedViewResolver);
    cnvResolver.setViewResolvers(resolvers);
    return cnvResolver;
}
Also used : ArrayList(java.util.ArrayList) ContentNegotiatingViewResolver(org.springframework.web.servlet.view.ContentNegotiatingViewResolver) ViewResolver(org.springframework.web.servlet.ViewResolver) ArticleRssFeedViewResolver(com.baeldung.spring.controller.rss.ArticleRssFeedViewResolver) InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) ContentNegotiatingViewResolver(org.springframework.web.servlet.view.ContentNegotiatingViewResolver) ArticleRssFeedViewResolver(com.baeldung.spring.controller.rss.ArticleRssFeedViewResolver) InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 50 with InternalResourceViewResolver

use of org.springframework.web.servlet.view.InternalResourceViewResolver in project tutorials by eugenp.

the class PushConfiguration method jspViewResolver.

@Bean
public InternalResourceViewResolver jspViewResolver() {
    InternalResourceViewResolver bean = new InternalResourceViewResolver();
    bean.setPrefix("/WEB-INF/views/");
    bean.setSuffix(".jsp");
    return bean;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

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