Package org.springframework.web.servlet.view.freemarker

Examples of org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver


        return freeMarkerConfigurer;
    }

    @Bean
    public FreeMarkerViewResolver freeMarkerViewResolver() {
        FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
        freeMarkerViewResolver.setOrder(1);
        freeMarkerViewResolver.setPrefix("view/");
        freeMarkerViewResolver.setSuffix(".ftl");
        freeMarkerViewResolver.setContentType("text/html;charset=UTF-8");
        return freeMarkerViewResolver;
    }
View Full Code Here


public class WebConfig extends WebMvcConfigurerAdapter {

  @Bean
  public ViewResolver getViewResolver() {
   
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
    resolver.setCache(false);
//    resolver.setPrefix("");
    resolver.setSuffix(".ftl");

    return resolver;
   
  }
View Full Code Here

  }

  private static class FreeMarkerRegistration extends UrlBasedViewResolverRegistration {

    private FreeMarkerRegistration() {
      super(new FreeMarkerViewResolver());
      getViewResolver().setSuffix(".ftl");
    }
View Full Code Here

    assertEquals(InternalResourceView.class, accessor.getPropertyValue("viewClass"));

    assertEquals(TilesViewResolver.class, resolvers.get(2).getClass());

    resolver = resolvers.get(3);
    FreeMarkerViewResolver freeMarkerViewResolver = (FreeMarkerViewResolver) resolver;
    accessor = new DirectFieldAccessor(resolver);
    assertEquals("freemarker-", accessor.getPropertyValue("prefix"));
    assertEquals(".freemarker", accessor.getPropertyValue("suffix"));
    assertArrayEquals(new String[] {"my*", "*Report"}, (String[]) accessor.getPropertyValue("viewNames"));
    assertEquals(1024, accessor.getPropertyValue("cacheLimit"));
View Full Code Here

  }

  @Test
  public void freeMarker() {
    this.registry.freeMarker().prefix("/").suffix(".fmt").cache(false);
    FreeMarkerViewResolver resolver = checkAndGetResolver(FreeMarkerViewResolver.class);
    checkPropertyValues(resolver, "prefix", "/", "suffix", ".fmt", "cacheLimit", 0);
  }
View Full Code Here

  }

  @Test
  public void freeMarkerDefaultValues() {
    this.registry.freeMarker();
    FreeMarkerViewResolver resolver = checkAndGetResolver(FreeMarkerViewResolver.class);
    checkPropertyValues(resolver, "prefix", "", "suffix", ".ftl");
  }
View Full Code Here

  @Configuration
  static class ExistingViewResolverConfig extends AbstractWebConfig {

    @Bean
    public FreeMarkerViewResolver freeMarkerViewResolver() {
      FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
      viewResolver.setSuffix(".ftl");
      return viewResolver;
    }
View Full Code Here

        return freeMarkerConfigurer;
    }

    @Bean
    public FreeMarkerViewResolver freeMarkerViewResolver() {
        FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
        freeMarkerViewResolver.setOrder(1);
        freeMarkerViewResolver.setPrefix("/WEB-INF/view/");
        freeMarkerViewResolver.setSuffix(".ftl");
        freeMarkerViewResolver.setContentType("text/html;charset=UTF-8");
        return freeMarkerViewResolver;
    }
View Full Code Here

    }

    @Bean
    @ConditionalOnMissingBean(name = "freeMarkerViewResolver")
    public FreeMarkerViewResolver freeMarkerViewResolver() {
      FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
      this.properties.applyToViewResolver(resolver);
      return resolver;
    }
View Full Code Here

  public String getGreeting() {
    return "Hello World";
  }

  private MockHttpServletResponse render(String viewName) throws Exception {
    FreeMarkerViewResolver resolver = this.context
        .getBean(FreeMarkerViewResolver.class);
    View view = resolver.resolveViewName(viewName, Locale.UK);
    assertThat(view, notNullValue());
    HttpServletRequest request = new MockHttpServletRequest();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE,
        this.context);
    MockHttpServletResponse response = new MockHttpServletResponse();
View Full Code Here

TOP

Related Classes of org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.