當前位置: 首頁>>代碼示例>>Java>>正文


Java CharEncoding類代碼示例

本文整理匯總了Java中org.apache.commons.lang.CharEncoding的典型用法代碼示例。如果您正苦於以下問題:Java CharEncoding類的具體用法?Java CharEncoding怎麽用?Java CharEncoding使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CharEncoding類屬於org.apache.commons.lang包,在下文中一共展示了CharEncoding類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
    log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
        isMultipart, isHtml, to, subject, content);

    // Prepare message using a Spring helper
    MimeMessage mimeMessage = javaMailSender.createMimeMessage();
    try {
        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
        message.setTo(to);
        message.setFrom(jHipsterProperties.getMail().getFrom());
        message.setSubject(subject);
        message.setText(content, isHtml);
        javaMailSender.send(mimeMessage);
        log.debug("Sent e-mail to User '{}'", to);
    } catch (Exception e) {
        log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
    }
}
 
開發者ID:GastonMauroDiaz,項目名稱:buenojo,代碼行數:20,代碼來源:MailService.java

示例2: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
    log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
        isMultipart, isHtml, to, subject, content);

    // Prepare message using a Spring helper
    MimeMessage mimeMessage = javaMailSender.createMimeMessage();
    try {
        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
        message.setTo(to);
        message.setFrom(jHipsterProperties.getMailgun().getFrom());
        message.setSubject(subject);
        message.setText(content, isHtml);
        javaMailSender.send(mimeMessage);
        log.debug("Sent e-mail to User '{}'", to);
    } catch (Exception e) {
        log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
    }
}
 
開發者ID:ugouku,項目名稱:shoucang,代碼行數:20,代碼來源:MailService.java

示例3: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
    log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
            isMultipart, isHtml, to, subject, content);

    // Prepare message using a Spring helper
    MimeMessage mimeMessage = javaMailSender.createMimeMessage();
    try {
        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
        message.setTo(to);
        message.setFrom(from);
        message.setSubject(subject);
        message.setText(content, isHtml);
        javaMailSender.send(mimeMessage);
        log.debug("Sent e-mail to User '{}'", to);
    } catch (Exception e) {
        log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
    }
}
 
開發者ID:VHAINNOVATIONS,項目名稱:BCDS,代碼行數:20,代碼來源:MailService.java

示例4: readSecurityKey

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
/**
 * 讀取配置文件中的證書信息
 * @author nan.li
 * @return
 */
private static String readSecurityKey()
{
    //去配置文件目錄去讀取這個秘鑰文件
    InputStream inputStream = PasswordKit.class.getClassLoader().getResourceAsStream(CERTIFICATE_CRT_PATH);
    if (inputStream != null)
    {
        try
        {
            return IOUtils.toString(inputStream, CharEncoding.UTF_8);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
        finally
        {
            StreamUtils.close(inputStream);
        }
    }
    return null;
}
 
開發者ID:lnwazg,項目名稱:kit,代碼行數:27,代碼來源:PasswordKit.java

示例5: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {

	log.trace("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", isMultipart,
			isHtml, to, subject, content);

	// Prepare message using a Spring helper
	MimeMessage mimeMessage = javaMailSender.createMimeMessage();
	try {
		MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
		message.setTo(to);
		message.setFrom(jHipsterProperties.getMail().getFrom());
		message.setSubject(subject);
		message.setText(content, isHtml);
		javaMailSender.send(mimeMessage);
		log.debug("Sent e-mail to User '{}'", to);
	} catch (Exception e) {
		log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
		log.error(javaMailSender.getJavaMailProperties().toString());
	}
}
 
開發者ID:TransparencyInternationalEU,項目名稱:lobbycal,代碼行數:22,代碼來源:MailService.java

示例6: forwardLobbycloudEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void forwardLobbycloudEmail(String to, String subject, ArrayList<EmailAttachment> attachments ) {

	MimeMessage mimeMessage = javaMailSender.createMimeMessage();
	try {
		MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, CharEncoding.UTF_8);
		message.setTo(to);
		message.setFrom(jHipsterProperties.getMail().getFrom());
		message.setSubject(subject);
		for (EmailAttachment emailAttachment : attachments) {
			message.addAttachment(emailAttachment.getEncodedName(), emailAttachment.getDataSource());
		}
		message.setText("see attachments", false);
		javaMailSender.send(mimeMessage);
		log.debug("Forwarded e-mail to '{}'", to);
	} catch (Exception e) {
		log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
		log.error(javaMailSender.getJavaMailProperties().toString());
	}
}
 
開發者ID:TransparencyInternationalEU,項目名稱:lobbycal,代碼行數:21,代碼來源:MailService.java

示例7: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
private Future<Void> sendEmail(String[] to, String subject, String content, boolean isMultipart,
    boolean isHtml) {
  log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
      isMultipart, isHtml, to, subject, content);

  // Prepare message using a Spring helper
  MimeMessage mimeMessage = javaMailSender.createMimeMessage();
  try {
    MimeMessageHelper message =
        new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
    message.setTo(to);
    message.setFrom(jhipsterProperties.getMail()
        .getFrom());
    message.setSubject(subject);
    message.setText(content, isHtml);
    javaMailSender.send(mimeMessage);

    log.debug("Sent e-mail to users '{}'", Arrays.toString(to));
  } catch (MessagingException e) {
    log.warn("E-mail could not be sent to users '{}', exception is: {}", 
        Arrays.toString(to), e.getMessage());
  }

  return new AsyncResult<>(null);
}
 
開發者ID:dzhw,項目名稱:metadatamanagement,代碼行數:27,代碼來源:MailService.java

示例8: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
 public void sendEmail(String to, String from, String subject, String content, boolean isMultipart, boolean isHtml, Map<String, File> files) throws Exception {
 	System.out.println("MailService.sendEmail()");
     MimeMessage mimeMessage = javaMailSender.createMimeMessage();
     try {
         MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
         message.setTo(to);
         message.setFrom(from);
         message.setSubject(subject);
         message.setText(content, isHtml);
         
         if (files != null && files.size() > 0) {
         	for (String key : files.keySet()) {
		FileSystemResource file = new FileSystemResource(files.get(key));
		message.addAttachment(key, file);
	}
}
         
         System.out.println("MailService.sendEmail()#send");
         javaMailSender.send(mimeMessage);
     } catch (Exception e) {
         e.printStackTrace();
     }
 }
 
開發者ID:gleb619,項目名稱:hotel_shop,代碼行數:25,代碼來源:MailService.java

示例9: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
    log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content.length={}",
        isMultipart, isHtml, to, subject, content.length());

    // Prepare message using a Spring helper
    MimeMessage mimeMessage = javaMailSender.createMimeMessage();
    try {
        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
        message.setTo(to);
        message.setFrom(from);
        message.setSubject(subject);
        message.setText(content, isHtml);
        javaMailSender.send(mimeMessage);
        log.debug("Sent e-mail to User '{}'", to);
    } catch (Exception e) {
        log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
    }
}
 
開發者ID:esutoniagodesu,項目名稱:egd-web,代碼行數:20,代碼來源:MailService.java

示例10: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
    log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
            isMultipart, isHtml, to, subject, content);

    // Prepare message using a Spring helper
    MimeMessage mimeMessage = javaMailSender.createMimeMessage();
    try {
        MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
        message.setTo(to);
        message.setFrom(from);
        message.setSubject(subject);
        message.setText(content, isHtml);
        javaMailSender.send(mimeMessage);
        log.debug("Sent e-mail to User '{}'!", to);
    } catch (Exception e) {
        log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
    }
}
 
開發者ID:sanketbajoria,項目名稱:jittrackGTS,代碼行數:20,代碼來源:MailService.java

示例11: sendEmail

import org.apache.commons.lang.CharEncoding; //導入依賴的package包/類
@Async
public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) {
  log.debug("Send e-mail[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}",
    isMultipart, isHtml, to, subject, content);

  MimeMessage mimeMessage = javaMailSender.createMimeMessage();
  try {
    MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, CharEncoding.UTF_8);
    message.setTo(to);
    message.setFrom(applicationProperties.getMail().getFrom());
    message.setSubject(subject);
    message.setText(content, isHtml);
    javaMailSender.send(mimeMessage);
    log.debug("Sent e-mail to User '{}'", to);
  } catch (Exception e) {
    log.warn("E-mail could not be sent to user '{}', exception is: {}", to, e.getMessage());
  }
}
 
開發者ID:priitl,項目名稱:p2p-webtv,代碼行數:19,代碼來源:MailService.java


注:本文中的org.apache.commons.lang.CharEncoding類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。