Java Code Examples for org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver#setSuffix()

The following examples show how to use org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver#setSuffix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetadataManagerControllerTest.java    From molgenis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@BeforeEach
void beforeMethod() {
  MockitoAnnotations.initMocks(this);
  FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
  freeMarkerViewResolver.setSuffix(".ftl");

  when(menuReaderService.findMenuItemPath(MetadataManagerController.METADATA_MANAGER))
      .thenReturn("/test/path");

  when(appSettings.getLanguageCode()).thenReturn("nl");
  User user = mock(User.class);
  when(userAccountService.getCurrentUser()).thenReturn(user);

  MetadataManagerController metadataEditorController =
      new MetadataManagerController(menuReaderService, metadataManagerService);

  mockMvc =
      MockMvcBuilders.standaloneSetup(metadataEditorController)
          .setLocaleResolver(localeResolver)
          .setMessageConverters(new FormHttpMessageConverter(), gsonHttpMessageConverter)
          .build();
}
 
Example 2
Source File: AccountControllerTest.java    From molgenis with GNU Lesser General Public License v3.0 6 votes vote down vote up
@BeforeEach
void setUp() {
  FreeMarkerViewResolver freeMarkerViewResolver = new FreeMarkerViewResolver();
  freeMarkerViewResolver.setSuffix(".ftl");
  mockMvc =
      MockMvcBuilders.standaloneSetup(authenticationController)
          .setMessageConverters(
              new FormHttpMessageConverter(), new GsonHttpMessageConverter(new Gson()))
          .build();

  reset(authenticationSettings);
  reset(reCaptchaService);
  reset(appSettings);
  when(reCaptchaService.validate("validCaptcha")).thenReturn(true);
  reset(accountService); // mocks in the config class are not resetted after each test
}
 
Example 3
Source File: FreeMarkerViewConfiguration.java    From apm-agent-java with Apache License 2.0 5 votes vote down vote up
@Bean
public FreeMarkerViewResolver freemarkerViewResolver() {
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
    resolver.setCache(true);
    resolver.setPrefix("");
    resolver.setSuffix(".ftl");
    return resolver;
}
 
Example 4
Source File: GlobalConfig.java    From pacbot with Apache License 2.0 5 votes vote down vote up
@Bean
public ViewResolver viewResolver() {
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
    resolver.setCache(true);
    resolver.setPrefix("");
    resolver.setSuffix(".html");
    resolver.setContentType("text/html; charset=UTF-8");
    return resolver;
}
 
Example 5
Source File: WebMvcAutoConfiguration.java    From halo with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Configuring view resolver
 *
 * @param registry registry
 */
@Override
public void configureViewResolvers(ViewResolverRegistry registry) {
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
    resolver.setAllowRequestOverride(false);
    resolver.setCache(false);
    resolver.setExposeRequestAttributes(false);
    resolver.setExposeSessionAttributes(false);
    resolver.setExposeSpringMacroHelpers(true);
    resolver.setSuffix(HaloConst.SUFFIX_FTL);
    resolver.setContentType("text/html; charset=UTF-8");
    registry.viewResolver(resolver);
}
 
Example 6
Source File: SpringContextConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean(name = "viewResolverFTL")
public FreeMarkerViewResolver getViewResolverFtl() {
    FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
    viewResolver.setPrefix("");
    viewResolver.setSuffix(".ftl");
    viewResolver.setOrder(1);
    return viewResolver;
}
 
Example 7
Source File: SpringWebReactiveConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean(name = "viewResolverFTL")
public FreeMarkerViewResolver getViewResolverFtl() {
    FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
    viewResolver.setPrefix("");
    viewResolver.setSuffix(".ftl");
    viewResolver.setOrder(1);
    return viewResolver;
}
 
Example 8
Source File: SpringContextConfig.java    From Spring-5.0-Cookbook with MIT License 5 votes vote down vote up
@Bean(name = "viewResolverFTL")
public FreeMarkerViewResolver getViewResolverFtl() {
    FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
    viewResolver.setPrefix("");
    viewResolver.setSuffix(".ftl");
    viewResolver.setOrder(1);
    return viewResolver;
}
 
Example 9
Source File: MolgenisWebAppConfig.java    From molgenis with GNU Lesser General Public License v3.0 5 votes vote down vote up
/** Enable spring freemarker viewresolver. All freemarker template names should end with '.ftl' */
@Bean
public ViewResolver viewResolver() {
  FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
  resolver.setCache(true);
  resolver.setSuffix(".ftl");
  resolver.setContentType("text/html;charset=UTF-8");
  return resolver;
}
 
Example 10
Source File: EmailConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
@Bean 
public FreeMarkerViewResolver freemarkerViewResolver() { 
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); 
    resolver.setCache(true); 
    resolver.setPrefix(""); 
    resolver.setSuffix(".ftl"); 
    return resolver; 
}
 
Example 11
Source File: FreemarkerConfiguration.java    From tutorials with MIT License 5 votes vote down vote up
@Bean 
public FreeMarkerViewResolver freemarkerViewResolver() { 
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver(); 
    resolver.setCache(true); 
    resolver.setPrefix(""); 
    resolver.setSuffix(".ftl"); 
    return resolver; 
}
 
Example 12
Source File: SpringWebConfig.java    From tutorials with MIT License 5 votes vote down vote up
@Bean
public FreeMarkerViewResolver freemarkerViewResolver() {
    FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
    resolver.setCache(true);
    resolver.setPrefix("");
    resolver.setSuffix(".ftl");
    return resolver;
}
 
Example 13
Source File: ViewResolutionIntegrationTests.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Bean
public FreeMarkerViewResolver freeMarkerViewResolver() {
	FreeMarkerViewResolver viewResolver = new FreeMarkerViewResolver();
	viewResolver.setSuffix(".ftl");
	return viewResolver;
}