本文整理匯總了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());
}
}
示例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());
}
}
示例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());
}
}
示例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;
}
示例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());
}
}
示例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());
}
}
示例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);
}
示例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();
}
}
示例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());
}
}
示例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());
}
}
示例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());
}
}