javax.mail.internet.MimeMessage.getDisposition()方法的使用及代码示例

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

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

MimeMessage.getDisposition介绍

[英]Returns the disposition from the "Content-Disposition" header field. This represents the disposition of this part. The disposition describes how the part should be presented to the user.

If the Content-Disposition field is unavailable, null is returned.

This implementation uses the getHeader method to obtain the requisite header field.
[中]从“内容处置”标题字段返回处置。这表示该部件的配置。处置描述了零件应如何呈现给用户。
如果内容处置字段不可用,则返回null
此实现使用getHeader方法来获取必需的头字段。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * Get the Content-Disposition.
 */
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: com.sun.mail/javax.mail

/**
 * Get the Content-Disposition.
 */
@Override
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: org.apache.james/james-server-core-library

/**
 * @see javax.mail.Part#getDisposition()
 */
public String getDisposition() throws MessagingException {
  return getWrappedMessage().getDisposition();
}

代码示例来源:origin: com.sun.mail/android-mail

/**
 * Get the Content-Disposition.
 */
@Override
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: com.sun.mail/jakarta.mail

/**
 * Get the Content-Disposition.
 */
@Override
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: org.glassfish.metro/webservices-extra

/**
 * Get the Content-Disposition.
 */
@Override
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: jboss/jboss-javaee-specs

/**
 * Get the Content-Disposition.
 */
@Override
public String getDisposition() throws MessagingException {
checkExpunged();
if (bodyLoaded)
  return super.getDisposition();
loadBODYSTRUCTURE();
return bs.disposition;
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

public void setFileName(String name) throws MessagingException {
  // there's an optional session property that requests file name encoding...we need to process this before
  // setting the value.
  if (name != null && SessionUtil.getBooleanProperty(session, MIME_ENCODEFILENAME, false)) {
    try {
      name = MimeUtility.encodeText(name);
    } catch (UnsupportedEncodingException e) {
      throw new MessagingException("Unable to encode filename", e);
    }
  }
  // get the disposition string.
  String disposition = getDisposition();
  // if not there, then this is an attachment.
  if (disposition == null) {
    disposition = Part.ATTACHMENT;
  }
  // now create a disposition object and set the parameter.
  ContentDisposition contentDisposition = new ContentDisposition(disposition);
  contentDisposition.setParameter("filename", name);
  // serialize this back out and reset.
  setDisposition(contentDisposition.toString());
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

public void setFileName(String name) throws MessagingException {
  // there's an optional session property that requests file name encoding...we need to process this before
  // setting the value.
  if (name != null && SessionUtil.getBooleanProperty(session, MIME_ENCODEFILENAME, false)) {
    try {
      name = MimeUtility.encodeText(name);
    } catch (UnsupportedEncodingException e) {
      throw new MessagingException("Unable to encode filename", e);
    }
  }
  // get the disposition string.
  String disposition = getDisposition();
  // if not there, then this is an attachment.
  if (disposition == null) {
    disposition = Part.ATTACHMENT;
  }
  // now create a disposition object and set the parameter.
  ContentDisposition contentDisposition = new ContentDisposition(disposition);
  contentDisposition.setParameter("filename", name);
  // serialize this back out and reset.
  setDisposition(contentDisposition.toString());
}

代码示例来源:origin: org.apache.james/james-server-jmap

@Test
public void serviceShouldKeepMessageAsItIsWhenMessageIsNotTextCalendar() throws Exception {
  String messageContent = "Content-type: text/html; method=REPLY; charset=UTF-8\n" +
    "Content-transfer-encoding: 8BIT\n" +
    "\n" +
    "BEGIN:VCALENDAR";
  MimeMessage message = MimeMessageUtil.mimeMessageFromString(messageContent);
  Mail mail = FakeMail.builder()
    .mimeMessage(message)
    .build();
  mailet.service(mail);
  assertThat(mail.getMessage().isMimeType("text/html")).isTrue();
  assertThat(mail.getMessage().getDisposition()).isNull();
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

public String getFileName() throws MessagingException {
  // see if there is a disposition.  If there is, parse off the filename parameter.
  String disposition = getDisposition();
  String filename = null;
  if (disposition != null) {
    filename = new ContentDisposition(disposition).getParameter("filename");
  }
  // if there's no filename on the disposition, there might be a name parameter on a
  // Content-Type header.
  if (filename == null) {
    String type = getContentType();
    if (type != null) {
      try {
        filename = new ContentType(type).getParameter("name");
      } catch (ParseException e) {
      }
    }
  }
  // if we have a name, we might need to decode this if an additional property is set.
  if (filename != null && SessionUtil.getBooleanProperty(session, MIME_DECODEFILENAME, false)) {
    try {
      filename = MimeUtility.decodeText(filename);
    } catch (UnsupportedEncodingException e) {
      throw new MessagingException("Unable to decode filename", e);
    }
  }
  return filename;
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

public String getFileName() throws MessagingException {
  // see if there is a disposition.  If there is, parse off the filename parameter.
  String disposition = getDisposition();
  String filename = null;
  if (disposition != null) {
    filename = new ContentDisposition(disposition).getParameter("filename");
  }
  // if there's no filename on the disposition, there might be a name parameter on a
  // Content-Type header.
  if (filename == null) {
    String type = getContentType();
    if (type != null) {
      try {
        filename = new ContentType(type).getParameter("name");
      } catch (ParseException e) {
      }
    }
  }
  // if we have a name, we might need to decode this if an additional property is set.
  if (filename != null && SessionUtil.getBooleanProperty(session, MIME_DECODEFILENAME, false)) {
    try {
      filename = MimeUtility.decodeText(filename);
    } catch (UnsupportedEncodingException e) {
      throw new MessagingException("Unable to decode filename", e);
    }
  }
  return filename;
}

代码示例来源:origin: miltonio/milton2

sm.setReplyTo(findReplyTo(mm));
sm.setSubject(findSubject(mm));
sm.setDisposition(mm.getDisposition());
sm.setEncoding(mm.getEncoding());
sm.setContentLanguage(findContentLanguage(mm.getContentLanguage()));

代码示例来源:origin: com.axway.ats.framework/ats-actionlibrary

try {
  if (messageContentType.startsWith(contentType)) {
    contentDisposition = message.getDisposition();
    if (!Part.ATTACHMENT.equalsIgnoreCase(contentDisposition)) {

代码示例来源:origin: org.codelibs.fess/fess-crawler

putValue(data, "Content-MD5", message.getContentMD5());
putValue(data, "Description", message.getDescription());
putValue(data, "Disposition", message.getDisposition());
putValue(data, "Encoding", message.getEncoding());
putValue(data, "File-Name", message.getFileName());

代码示例来源:origin: org.codelibs.robot/s2-robot

putValue(data, "Disposition", message.getDisposition());
} catch (Exception e) {

相关文章

MimeMessage类方法