Example usage for org.springframework.ui.freemarker FreeMarkerConfigurationFactory FreeMarkerConfigurationFactory

List of usage examples for org.springframework.ui.freemarker FreeMarkerConfigurationFactory FreeMarkerConfigurationFactory

Introduction

In this page you can find the example usage for org.springframework.ui.freemarker FreeMarkerConfigurationFactory FreeMarkerConfigurationFactory.

Prototype

FreeMarkerConfigurationFactory

Source Link

Usage

From source file:com.homesoft.component.report.pdf.XhtmlPdfGenerator.java

protected static void init() {
    instance = new XhtmlPdfGenerator();
    fmConfigFactory = new FreeMarkerConfigurationFactory();
    try {/*ww  w. j  a  v  a  2 s.co m*/
        fmConfig = fmConfigFactory.createConfiguration();
    } catch (IOException e) {
        log.error(e.getMessage(), e);
    } catch (TemplateException e) {
        log.error(e.getMessage(), e);
    }
}

From source file:com.gnizr.web.action.user.TestRequestPasswordReset.java

protected void setUp() throws Exception {
    super.setUp();

    gnizrConfiguration = new GnizrConfiguration();
    gnizrConfiguration.setSiteContactEmail("admin@mysite.com");
    gnizrConfiguration.setWebApplicationUrl("http://foo.com/gnizr");

    FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
    factory.setTemplateLoaderPath("/templates");
    freemarkerEngine = factory.createConfiguration();

    userManager = new UserManager(getGnizrDao());
    tokenManager = new TokenManager();
    tokenManager.setUserManager(userManager);
    tokenManager.init();/*ww  w  .  j  av  a2  s. c  om*/

    templateMessage = new SimpleMailMessage();
    templateMessage.setSubject("Reset Password");

    mailSender = new JavaMailSenderImpl();
    mailSender.setHost("localhost");

    action = new RequestPasswordReset();
    action.setUserManager(userManager);
    action.setTokenManager(tokenManager);
    action.setVerifyResetTemplate(templateMessage);
    action.setMailSender(mailSender);
    action.setFreemarkerEngine(freemarkerEngine);
    action.setGnizrConfiguration(gnizrConfiguration);
}

From source file:com.gnizr.web.action.user.TestApproveUserAccount.java

protected void setUp() throws Exception {
    super.setUp();

    mailSender = new JavaMailSenderImpl();
    mailSender.setHost("localhost");

    gnizrConfiguration = new GnizrConfiguration();
    gnizrConfiguration.setSiteContactEmail("admin@mysite.com");
    gnizrConfiguration.setWebApplicationUrl("http://foo.com/gnizr");

    FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
    factory.setTemplateLoaderPath("/templates");
    freemarkerEngine = factory.createConfiguration();

    welcomeMessage = new SimpleMailMessage();
    welcomeMessage.setSubject("Welcome");

    userManager = new UserManager(getGnizrDao());
    tokenManager = new TokenManager();
    tokenManager.setUserManager(userManager);
    tokenManager.init();// www  .j  a  v a 2 s . c o  m

    action = new ApproveUserAccount();
    action.setUserManager(userManager);
    action.setTokenManager(tokenManager);
    action.setGnizrConfiguration(gnizrConfiguration);
    action.setWelcomeEmailTemplate(welcomeMessage);
    action.setFreemarkerEngine(freemarkerEngine);
    action.setMailSender(mailSender);

    username = "hchen1";
    token = tokenManager.createResetToken(new User(username));
}

From source file:com.gnizr.web.action.user.TestRegisterUser.java

protected void setUp() throws Exception {
    super.setUp();

    gnizrConfiguration = new GnizrConfiguration();
    gnizrConfiguration.setSiteContactEmail("admin@mysite.com");
    gnizrConfiguration.setWebApplicationUrl("http://foo.com/gnizr");

    FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
    factory.setTemplateLoaderPath("/templates");
    freemarkerEngine = factory.createConfiguration();

    userManager = new UserManager(getGnizrDao());
    tokenManager = new TokenManager();
    tokenManager.setUserManager(userManager);
    tokenManager.init();/*from  ww  w .j  a v  a 2 s  .c  om*/

    templateMessage = new SimpleMailMessage();
    templateMessage.setSubject("Email Verification");

    notifyMessage = new SimpleMailMessage();
    notifyMessage.setSubject("Account Registration Pending");

    approvalMessage = new SimpleMailMessage();
    approvalMessage.setSubject("Account Registration Approval");

    mailSender = new JavaMailSenderImpl();
    mailSender.setHost("localhost");

    action = new RegisterUser();
    action.setUserManager(userManager);
    action.setTokenManager(tokenManager);
    action.setVerifyEmailTemplate(templateMessage);
    action.setApprovalEmailTemplate(approvalMessage);
    action.setNotifyEmailTemplate(notifyMessage);
    action.setMailSender(mailSender);
    action.setFreemarkerEngine(freemarkerEngine);
    action.setGnizrConfiguration(gnizrConfiguration);
}

From source file:net.javacrumbs.springws.test.template.FreeMarkerTemplateProcessor.java

public void afterPropertiesSet() {
    if (configurationFactory == null) {
        configurationFactory = new FreeMarkerConfigurationFactory();
        Properties settings = new Properties();
        settings.put(Configuration.LOCALIZED_LOOKUP_KEY, "false");
        configurationFactory.setFreemarkerSettings(settings);
        configurationFactory/*w ww.ja  v  a2 s . co m*/
                .setPreTemplateLoaders(new TemplateLoader[] { new SimpleTemplateLoader(resourceLoader) });
    }

}

From source file:org.craftercms.commons.mail.impl.EmailFactoryImplTest.java

private Configuration createFreeMarkerConfig() throws Exception {
    FreeMarkerConfigurationFactory factory = new FreeMarkerConfigurationFactory();
    factory.setDefaultEncoding(ENCODING);
    factory.setTemplateLoaderPath("classpath:mail/templates");

    return factory.createConfiguration();
}