javax.mail.Message.getDataHandler()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中javax.mail.Message.getDataHandler()方法的一些代码示例,展示了Message.getDataHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getDataHandler()方法的具体详情如下:
包路径:javax.mail.Message
类名称:Message
方法名:getDataHandler

Message.getDataHandler介绍

暂无

代码示例

代码示例来源:origin: oblac/jodd

@Test
void testSimpleText() throws MessagingException, IOException {
  final Email email = Email.create()
    .from(FROM_EXAMPLE_COM)
    .to(TO_EXAMPLE_COM)
    .subject(SUB)
    .textMessage(HELLO);
  final Message message = createMessage(email);
  final String content = (String) message.getContent();
  assertEquals(HELLO, content);
  assertTrue(message.getDataHandler().getContentType().contains("text/plain"));
}

代码示例来源:origin: oblac/jodd

@Test
void testSimpleTextWithCyrilic() throws MessagingException, IOException {
  final Email email = Email.create()
    .from("Тијана Милановић <t@gmail.com>")
    .to("Јодд <i@jodd.com>")
    .subject("Здраво!")
    .textMessage("шта радиш?");
  final Message message = createMessage(email);
  final String content = (String) message.getContent();
  assertEquals("шта радиш?", content);
  assertTrue(message.getDataHandler().getContentType().contains("text/plain"));
  assertEquals("=?UTF-8?B?0KLQuNGY0LDQvdCwINCc0LjQu9Cw0L3QvtCy0LjRmw==?= <t@gmail.com>", message.getFrom()[0].toString());
  assertEquals("=?UTF-8?B?0IjQvtC00LQ=?= <i@jodd.com>", message.getRecipients(RecipientType.TO)[0].toString());
}

代码示例来源:origin: google/mail-importer

@Override
public DataHandler getDataHandler() throws RuntimeMessagingException {
 try {
  return delegate.getDataHandler();
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

代码示例来源:origin: spring-projects/spring-ws

@Override
protected InputStream getResponseInputStream() throws IOException {
  try {
    return responseMessage.getDataHandler().getInputStream();
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected InputStream getResponseInputStream() throws IOException {
  try {
    return responseMessage.getDataHandler().getInputStream();
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
}

代码示例来源:origin: org.springframework.ws/spring-ws-support

@Override
protected InputStream getResponseInputStream() throws IOException {
  try {
    return responseMessage.getDataHandler().getInputStream();
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
}

相关文章