Package org.thymeleaf.spring4.processor.attr

Examples of org.thymeleaf.spring4.processor.attr.AbstractSpringFieldAttrProcessor


  }

  @Bean
  @Exposed
  public TemplateResolver templateResolver() {
    TemplateResolver resolver = new SpringResourceTemplateResolver();
    resolver.setCharacterEncoding( "UTF-8" );
    resolver.setTemplateMode( "HTML5" );
    resolver.setCacheable( !developmentMode.isActive() );
    resolver.setPrefix( "classpath:/views/" );
    resolver.setSuffix( ".thtml" );
    resolver.setOrder( 20 );

    return resolver;
  }
View Full Code Here


    context.register(ThymeleafAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class);
    MockServletContext servletContext = new MockServletContext();
    context.setServletContext(servletContext);
    context.refresh();
    ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class)
        .resolveViewName("view", Locale.UK);
    MockHttpServletResponse response = new MockHttpServletResponse();
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);
    view.render(Collections.singletonMap("foo", "bar"), request, response);
    String result = response.getContentAsString();
    assertTrue("Wrong result: " + result, result.contains("<title>Content</title>"));
    assertTrue("Wrong result: " + result, result.contains("<span>bar</span>"));
    context.close();
  }
View Full Code Here

@Configuration
public class CustomMvcConfig {

    @Bean
    public ThymeleafViewResolver thymeleafViewResolver(SpringTemplateEngine templateEngine) {
        ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
        viewResolver.setOrder(Ordered.HIGHEST_PRECEDENCE - 10);
        viewResolver.setTemplateEngine(templateEngine);
        return viewResolver;
    }
View Full Code Here

        return templateEngine;
    }

    @Bean
    public ThymeleafViewResolver viewResolver(SpringTemplateEngine templateEngine) {
        ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
        viewResolver.setTemplateEngine(templateEngine);
        viewResolver.setViewClass(ThymeleafTilesView.class);
        return viewResolver;
    }
View Full Code Here

        return templateEngine;
    }

    @Bean
    public ViewResolver viewResolver(){
        ThymeleafViewResolver viewResolver = new ThymeleafViewResolver() ;
        viewResolver.setTemplateEngine(templateEngine());
        viewResolver.setOrder(1);

        return viewResolver;
    }
View Full Code Here

        return templateEngine;
    }

    @Bean
    public ViewResolver viewResolver(){
        ThymeleafViewResolver viewResolver = new ThymeleafViewResolver() ;
        viewResolver.setTemplateEngine(templateEngine());
        viewResolver.setOrder(1);

        return viewResolver;
    }
View Full Code Here

    return templateResolver;
  }

  @Bean
  public ThymeleafViewResolver viewResolver() {
    ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
    viewResolver.setViewClass(ThymeleafTilesView.class);
    viewResolver.setTemplateEngine(templateEngine());
    viewResolver.setCharacterEncoding("UTF-8");
    return viewResolver;
  }
View Full Code Here

        return templateEngine;
    }

    @Bean
    public ThymeleafViewResolver viewResolver() {
        ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
        thymeleafViewResolver.setTemplateEngine(templateEngine());
        thymeleafViewResolver.setCharacterEncoding("UTF-8");
        return thymeleafViewResolver;
    }
View Full Code Here

        return templateEngine;
    }

    @Bean
    public ThymeleafViewResolver viewResolver() {
        ThymeleafViewResolver thymeleafViewResolver = new ThymeleafViewResolver();
        thymeleafViewResolver.setTemplateEngine(templateEngine());
        thymeleafViewResolver.setCharacterEncoding("UTF-8");
        return thymeleafViewResolver;
    }
View Full Code Here

    private SpringTemplateEngine templateEngine;

    @Bean
    @ConditionalOnMissingBean(name = "thymeleafViewResolver")
    public ThymeleafViewResolver thymeleafViewResolver() {
      ThymeleafViewResolver resolver = new ThymeleafViewResolver();
      resolver.setTemplateEngine(this.templateEngine);
      resolver.setCharacterEncoding(this.properties.getEncoding());
      resolver.setContentType(appendCharset(this.properties.getContentType(),
          resolver.getCharacterEncoding()));
      resolver.setExcludedViewNames(this.properties.getExcludedViewNames());
      resolver.setViewNames(this.properties.getViewNames());
      // This resolver acts as a fallback resolver (e.g. like a
      // InternalResourceViewResolver) so it needs to have low precedence
      resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 5);
      return resolver;
    }
View Full Code Here

TOP

Related Classes of org.thymeleaf.spring4.processor.attr.AbstractSpringFieldAttrProcessor

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.