Java 类javax.activation.CommandMap 实例源码

项目:OpenJSharp    文件:BindingImpl.java   
public static void initializeJavaActivationHandlers() {
    // DataHandler.writeTo() may search for DCH. So adding some default ones.
    try {
        CommandMap map = CommandMap.getDefaultCommandMap();
        if (map instanceof MailcapCommandMap) {
            MailcapCommandMap mailMap = (MailcapCommandMap) map;

            // registering our DCH since javamail's DCH doesn't handle
            if (!cmdMapInitialized(mailMap)) {
                mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
                mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
            }
        }
    } catch (Throwable t) {
        // ignore the exception.
    }
}
项目:openjdk-jdk10    文件:BindingImpl.java   
public static void initializeJavaActivationHandlers() {
    // DataHandler.writeTo() may search for DCH. So adding some default ones.
    try {
        CommandMap map = CommandMap.getDefaultCommandMap();
        if (map instanceof MailcapCommandMap) {
            MailcapCommandMap mailMap = (MailcapCommandMap) map;

            // registering our DCH since javamail's DCH doesn't handle
            if (!cmdMapInitialized(mailMap)) {
                mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
                mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
            }
        }
    } catch (Throwable t) {
        // ignore the exception.
    }
}
项目:openjdk9    文件:BindingImpl.java   
public static void initializeJavaActivationHandlers() {
    // DataHandler.writeTo() may search for DCH. So adding some default ones.
    try {
        CommandMap map = CommandMap.getDefaultCommandMap();
        if (map instanceof MailcapCommandMap) {
            MailcapCommandMap mailMap = (MailcapCommandMap) map;

            // registering our DCH since javamail's DCH doesn't handle
            if (!cmdMapInitialized(mailMap)) {
                mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
                mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
            }
        }
    } catch (Throwable t) {
        // ignore the exception.
    }
}
项目:Service-Notes    文件:Mail.java   
public Mail() {
    _host = "smtp.gmail.com"; // default smtp server
    _port = "465"; // default smtp port
    _sport = "465"; // default socketfactory port

    _user = ""; // username
    _pass = ""; // password
    _from = ""; // email sent from
    _subject = ""; // email subject
    _body = ""; // email body

    _debuggable = false; // debug mode on or off - default off
    _auth = true; // smtp authentication - default on

    _multipart = new MimeMultipart();

    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added.
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:beige-software    文件:MailSenderStd.java   
/**
 * <p>Only constructor.</p>
 * @param pLogger logger
 **/
public MailSenderStd(final ILogger pLogger) {
  this.logger = pLogger;
  MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
  boolean mcapOk = false;
  for (String mcap : mc.getMimeTypes()) {
    if (mcap.contains("multipart")) {
      mcapOk = true;
      break;
    }
  }
  if (!mcapOk) { //Fix android
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content- handler=com.sun.mail.handlers.message_rfc822");
    this.logger.info(null, MailSenderStd.class, "Mailcap has been fixed");
  }
}
项目:hermes    文件:SMIMEHandler.java   
/**
Setup the MailCommandMap programmatically. It sets which ContentType 
should be handled by which type of DataHandler.
*/
private static void setupMailCommandMap() {
    MailcapCommandMap mailcap = (MailcapCommandMap)CommandMap.
    getDefaultCommandMap();
    mailcap.addMailcap("application/pkcs7-mime;; x-java-content-handler=" + 
    "org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mailcap.addMailcap("application/x-pkcs7-mime;; x-java-content-handler" +
    "=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mailcap.addMailcap("application/pkcs7-signature;; x-java-content-" + 
    "handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mailcap.addMailcap("application/x-pkcs7-signature;; x-java-content-" + 
    "handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mailcap.addMailcap("multipart/signed;; x-java-content-handler=" + 
    "org.bouncycastle.mail.smime.handlers.multipart_signed");
    CommandMap.setDefaultCommandMap(mailcap);
}
项目:lookaside_java-1.8.0-openjdk    文件:BindingImpl.java   
public static void initializeJavaActivationHandlers() {
    // DataHandler.writeTo() may search for DCH. So adding some default ones.
    try {
        CommandMap map = CommandMap.getDefaultCommandMap();
        if (map instanceof MailcapCommandMap) {
            MailcapCommandMap mailMap = (MailcapCommandMap) map;

            // registering our DCH since javamail's DCH doesn't handle
            if (!cmdMapInitialized(mailMap)) {
                mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
                mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
            }
        }
    } catch (Throwable t) {
        // ignore the exception.
    }
}
项目:Service-Notes    文件:Mail.java   
public Mail() {
    _host = "smtp.gmail.com"; // default smtp server
    _port = "465"; // default smtp port
    _sport = "465"; // default socketfactory port

    _user = ""; // username
    _pass = ""; // password
    _from = ""; // email sent from
    _subject = ""; // email subject
    _body = ""; // email body

    _debuggable = false; // debug mode on or off - default off
    _auth = true; // smtp authentication - default on

    _multipart = new MimeMultipart();

    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added.
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:gdata-java-client    文件:MediaMultipart.java   
/**
 * Loads the default set of Java activation MIME mappings required by
 * the GData library.  Extends the basic set configured by the JavaMail
 * library to add mappings for Atom, RSS, and JSON application types.
 */
public static void loadMimeMappings() {
  final String[] CONTENT_TYPES = new String[] {
      "application/atom+xml", "application/rss+xml", "application/json"
  };

  final String CONTENT_HANDLER = ";; x-java-content-handler"
      + "=com.google.gdata.data.media.GDataContentHandler";

  CommandMap commandMap = CommandMap.getDefaultCommandMap();
  if (commandMap instanceof MailcapCommandMap) {
    MailcapCommandMap mailcapMap = (MailcapCommandMap) commandMap;
    for (int i = 0; i < CONTENT_TYPES.length; i++) {
      CommandInfo[] comm = mailcapMap.getAllCommands(CONTENT_TYPES[i]);
      if (comm == null || comm.length == 0) {
        mailcapMap.addMailcap(CONTENT_TYPES[i] + CONTENT_HANDLER);
      }
    }
  } else {
    LOGGER.warning(
        "Unable to find MailcapCommandMap, skipping dynamic mailcap config.");
  }
}
项目:infobip-open-jdk-8    文件:BindingImpl.java   
public static void initializeJavaActivationHandlers() {
    // DataHandler.writeTo() may search for DCH. So adding some default ones.
    try {
        CommandMap map = CommandMap.getDefaultCommandMap();
        if (map instanceof MailcapCommandMap) {
            MailcapCommandMap mailMap = (MailcapCommandMap) map;

            // registering our DCH since javamail's DCH doesn't handle
            if (!cmdMapInitialized(mailMap)) {
                mailMap.addMailcap("text/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("application/xml;;x-java-content-handler=com.sun.xml.internal.ws.encoding.XmlDataContentHandler");
                mailMap.addMailcap("image/*;;x-java-content-handler=com.sun.xml.internal.ws.encoding.ImageDataContentHandler");
                mailMap.addMailcap("text/plain;;x-java-content-handler=com.sun.xml.internal.ws.encoding.StringDataContentHandler");
            }
        }
    } catch (Throwable t) {
        // ignore the exception.
    }
}
项目:SuperLog    文件:LogMail.java   
private void init(String host, String port) {
    multipart = new MimeMultipart();
    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added.
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);

    props = new Properties();

    props.put("mail.smtp.host", host);
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.port", port);
    props.put("mail.smtp.socketFactory.port", port);
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
    props.put("mail.smtp.socketFactory.fallback", "false");
}
项目:cloud_android_client    文件:Mail.java   
public Mail() { 
    _host = "smtp.gmail.com"; // default smtp server 
    _port = "465"; // default smtp port 
    _sport = "465"; // default socketfactory port 

    _user = ""; // username 
    _pass = ""; // password 
    _from = ""; // email sent from 
    _subject = ""; // email subject 
    _body = ""; // email body 

    _debuggable = false; // debug mode on or off - default off 
    _auth = true; // smtp authentication - default on 

    _multipart = new MimeMultipart(); 

    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added. 
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); 
    CommandMap.setDefaultCommandMap(mc); 
}
项目:CookEase    文件:Mail.java   
public Mail() { 
  _host = "smtp.gmail.com"; // default smtp server 
  _port = "465"; // default smtp port 
  _sport = "465"; // default socketfactory port 

  _user = ""; // username 
  _pass = ""; // password 
  _from = ""; // email sent from 
  _subject = ""; // email subject 
  _body = ""; // email body 

  _debuggable = false; // debug mode on or off - default off 
  _auth = true; // smtp authentication - default on 

  _multipart = new MimeMultipart(); 

  // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added. 
  MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
  mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
  mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
  mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
  mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
  mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); 
  CommandMap.setDefaultCommandMap(mc); 
}
项目:vocefiscal-android    文件:GMailSender.java   
public GMailSender() 
{ 
  host = "smtp.gmail.com"; // default smtp server 
  port = "465"; // default smtp port 
  sport = "465"; // default socketfactory port 

  user = ""; // username 
  pass = ""; // password 
  from = ""; // email sent from 
  subject = ""; // email subject 
  body = ""; // email body 

  debuggable = false; // debug mode on or off - default off 
  auth = true; // smtp authentication - default on 

  multipart = new MimeMultipart(); 

  // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added. 
  MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
  mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
  mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
  mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
  mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
  mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); 
  CommandMap.setDefaultCommandMap(mc); 
}
项目:TV-Notification    文件:Mail.java   
public Mail() {
  _host = "smtp.gmail.com"; // default smtp server
  _port = "465"; // default smtp port
  _sport = "465"; // default socketfactory port

  _user = ""; // username
  _pass = ""; // password
  _from = ""; // email sent from
  _subject = ""; // email subject
  _body = ""; // email body

  _debuggable = false; // debug mode on or off - default off
  _auth = true; // smtp authentication - default on

  _multipart = new MimeMultipart();

  // There is something wrong with MailCap, javamail can not find a handler
  // for the multipart/mixed part, so this bit needs to be added.
  MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
  mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
  mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
  mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
  mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
  mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
  CommandMap.setDefaultCommandMap(mc);
}
项目:droidMail    文件:Mailer.java   
/**
 * Constructor: Creates a new {@code Mailer} with the given configuration. The password must be the same password used when constructing
 * the {@link MailConfiguration}. To avoid hardcoding the password, or passing it around as a public or protected variable, 
 * use {@code MailOptions.getMailer()} or {@code MailConfigStore.createMailer(String)}.
 * @param config the configuration that provides the source account information
 * @param password the password associated with {@code config}
 * @see MailConfiguration#createMailer()
 * @see MailOptions#getMailer()
 */
public Mailer(MailConfiguration config, String password)
{
    if (config == null)
        throw new NullPointerException("Cannot create new Mailer with null configuration!");

    this.config = config;
    this.password = password;

    multipart = new MimeMultipart(); 

    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added. 
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); 
    CommandMap.setDefaultCommandMap(mc);
}
项目:irma_future_id    文件:SMIMETestSetup.java   
protected void setUp()
{
    Security
            .addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

    MailcapCommandMap _mailcap = (MailcapCommandMap)CommandMap
            .getDefaultCommandMap();

    _mailcap
            .addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    _mailcap
            .addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    _mailcap
            .addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    _mailcap
            .addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    _mailcap
            .addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    originalMap = CommandMap.getDefaultCommandMap();
    CommandMap.setDefaultCommandMap(_mailcap);
}
项目:bc-java    文件:SMIMETestSetup.java   
protected void setUp()
{
    Security
            .addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

    MailcapCommandMap _mailcap = (MailcapCommandMap)CommandMap
            .getDefaultCommandMap();

    _mailcap
            .addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    _mailcap
            .addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    _mailcap
            .addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    _mailcap
            .addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    _mailcap
            .addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    originalMap = CommandMap.getDefaultCommandMap();
    CommandMap.setDefaultCommandMap(_mailcap);
}
项目:chat.android    文件:Mail.java   
public Mail() { 
    _host = "smtp.gmail.com"; // default smtp server 
    _port = "465"; // default smtp port 
    _sport = "465"; // default socketfactory port 

    _user = ""; // username 
    _pass = ""; // password 
    _from = ""; // email sent from 
    _subject = ""; // email subject 
    _body = ""; // email body 

    _debuggable = false; // debug mode on or off - default off 
    _auth = true; // smtp authentication - default on 

    _multipart = new MimeMultipart(); 

    // There is something wrong with MailCap, javamail can not find a handler for the multipart/mixed part, so this bit needs to be added. 
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); 
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html"); 
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml"); 
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain"); 
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed"); 
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822"); 
    CommandMap.setDefaultCommandMap(mc); 
}
项目:Parallator    文件:MailSender.java   
public MailSender(String subject, String body) {
    this.subject = subject;
    this.body = body;

    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:hermes    文件:SMimeMessage.java   
/**
 * Sets the default mail caps.
 */
private void setDefaults() {
    MailcapCommandMap mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();

    for (int i = 0; i < mailcaps.length; i++)
    {
      CommandInfo command = mailcap.getCommand(mailcaps[i].getMimeType(), mailcaps[i].getCommandName());
      if (command == null || !command.getCommandClass().equals(mailcaps[i].getClassName()))
      {
        mailcap.addMailcap(mailcaps[i].toString());
      }
    }

    CommandMap.setDefaultCommandMap(mailcap);
}
项目:hermes    文件:AS2PlusProcessor.java   
private void initActivationFramework() {
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    String[] caps = this.getProperties(PROPERTY_MAILCAPS);
    for (int i=0; i<caps.length; i++) {
        mc.addMailcap(caps[i]);
    }
    CommandMap.setDefaultCommandMap(mc);
}
项目:hermes    文件:AS2Processor.java   
private static void initActivationFramework() {
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    String[] caps = core.properties.getProperties(PROPERTY_MAILCAPS);
    for (int i=0; i<caps.length; i++) {
        mc.addMailcap(caps[i]);
    }
    CommandMap.setDefaultCommandMap(mc);
}
项目:oap    文件:DefaultMailman.java   
private void initMailCap() {
    MailcapCommandMap mc = ( MailcapCommandMap ) CommandMap.getDefaultCommandMap();
    mc.addMailcap( "text/html;; x-java-content-handler=com.sun.mail.handlers.text_html" );
    mc.addMailcap( "text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml" );
    mc.addMailcap( "text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain" );
    mc.addMailcap( "multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed" );
    mc.addMailcap( "message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822" );
    CommandMap.setDefaultCommandMap( mc );
}
项目:switchyard    文件:ClasspathScannerTest.java   
@Test
public void test_archive_scan() throws IOException {
    InstanceOfFilter filter = new InstanceOfFilter(CommandMap.class);
    ClasspathScanner scanner = new ClasspathScanner(filter);

    // If running this test inside your IDE... you need to set the cwd to be the
    // root of the config module !!
    scanner.scan(new File("./src/test/resources/classpathscan-test.jar").toURI().toURL());
    List<Class<?>> classes = filter.getMatchedTypes();

    Assert.assertTrue(classes.contains(CommandMap.class));
    Assert.assertTrue(classes.contains(MailcapCommandMap.class));
}
项目:BgMailerLib    文件:MailConfig.java   
public MailConfig() {
    _host = "smtp.gmail.com"; // default smtp server
    _port = "465"; // default smtp port
    _sport = "465"; // default socketfactory port

    _user = ""; // username
    _pass = ""; // password
    _from = ""; // email sent from
    _subject = ""; // email subject
    _body = ""; // email body

    _debuggable = false; // debug mode on or off - default off
    _auth = true; // smtp authentication - default on

    _multipart = new MimeMultipart();

    // There is something wrong with MailCap, javamail can not find a
    // handler for the multipart/mixed part, so this bit needs to be added.
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap
            .getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:AccelerationAlert    文件:Mail.java   
public Mail()
{
    _host = "smtp.gmail.com"; // default smtp server
    _port = "465"; // default smtp port
    _sport = "465"; // default socketfactory port

    _user = ""; // username
    _pass = ""; // password
    _from = ""; // email sent from
    _subject = ""; // email subject
    _body = ""; // email body

    _debuggable = false; // debug mode on or off - default off
    _auth = true; // smtp authentication - default on

    _multipart = new MimeMultipart();

    // There is something wrong with MailCap, javamail can not find a
    // handler for the multipart/mixed part, so this bit needs to be added.
    MailcapCommandMap mc = (MailcapCommandMap) CommandMap
            .getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:logic4mqtt    文件:Mail.java   
protected Mail()
{
    // add handlers for main MIME types (this normally comes from mail.jar's META-INF, but fails
    // if we have a fat jar
    MailcapCommandMap mc = (MailcapCommandMap)CommandMap.getDefaultCommandMap();
    mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
    mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
    mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
    mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
    mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
    CommandMap.setDefaultCommandMap(mc);
}
项目:irma_future_id    文件:SMIMESignedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:irma_future_id    文件:SMIMEEnvelopedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:irma_future_id    文件:SMIMESignedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:bc-java    文件:SMIMESignedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:bc-java    文件:SMIMEEnvelopedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:bc-java    文件:SMIMESignedGenerator.java   
private static MailcapCommandMap addCommands(CommandMap cm)
{
    MailcapCommandMap mc = (MailcapCommandMap)cm;

    mc.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mc.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mc.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature");
    mc.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mc.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");

    return mc;
}
项目:jdk8u-jdk    文件:MailTest.java   
static void workaroundJAFSetup() {
    MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
}
项目:openjdk-jdk10    文件:MailTest.java   
static void workaroundJAFSetup() {
    MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
}
项目:openjdk9    文件:MailTest.java   
static void workaroundJAFSetup() {
    MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
}
项目:hermes    文件:IncomingMessageProcessorTest.java   
@Override
public void setUp() throws Exception {
    commitSQL(MessageDAO.class, CREATE_TABLE_SQL);
    LOG.debug("Set up");

    //Setting Mail Cap
    MailcapCommandMap mailcaps = new MailcapCommandMap();
    mailcaps.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mailcaps.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mailcaps.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature"); 
    mailcaps.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mailcaps.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");
    mailcaps.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");

    mailcaps.addMailcap("application/deflate;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("message/disposition-notification;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/EDI-X12;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/EDIFACT;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/edi-consent;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/XML;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/octet-stream;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    CommandMap.setDefaultCommandMap(mailcaps);

    //Prepare the Partnership DVO
    PartnershipDAO partnershipDAO = (PartnershipDAO) TARGET.getDAOFactory().createDAO(PartnershipDAO.class);
    partnershipDVO = (PartnershipDVO) partnershipDAO.createDVO();
    partnershipDVO.setIsDisabled(false);
    partnershipDVO.setPartnershipId("IncomingMessageProcessorTest");
    partnershipDVO.setAs2From("as2From");
    partnershipDVO.setAs2To("as2To");
    partnershipDVO.setSubject("OutgoingMessageProcessor Unit Test");
    partnershipDVO.setIsSyncReply(false);
    partnershipDVO.setReceiptAddress("http://127.0.0.1:8080/corvus/httpd/as2/inbound");
    partnershipDVO.setRecipientAddress("http://127.0.0.1:8080/corvus/httpd/as2/inbound");
    partnershipDVO.setIsReceiptRequired(false);

    partnershipDVO.setIsReceiptSignRequired(true);
    partnershipDVO.setIsInboundEncryptRequired(false);
    partnershipDVO.setIsInboundSignRequired(false);

    partnershipDVO.setIsOutboundCompressRequired(false);
    partnershipDVO.setIsOutboundEncryptRequired(false);
    partnershipDVO.setIsOutboundSignRequired(false);

    partnershipDVO.setSignAlgorithm(PartnershipDVO.ALG_SIGN_SHA1);
    partnershipDVO.setEncryptAlgorithm(PartnershipDVO.ALG_ENCRYPT_3DES);
    partnershipDVO.setMicAlgorithm(PartnershipDVO.ALG_MIC_SHA1);

    partnershipDVO.setVerifyCert(IOHandler.readBytes(FIXTURE_LOADER.getResourceAsStream("security/corvus.cer")));
    partnershipDVO.setEncryptCert(IOHandler.readBytes(FIXTURE_LOADER.getResourceAsStream("security/corvus.cer")));
    partnershipDAO.create(partnershipDVO);


    //Initialise AS2 Message
    msgId = RANDOM.toString();
    AS2Message as2Msg = new AS2Message();
    as2Msg.setFromPartyID("as2To");
    as2Msg.setToPartyID("as2From");
    as2Msg.setMessageID(msgId);
    as2Msg.setHeader(AS2Header.SUBJECT, partnershipDVO.getSubject());
    as2Msg.setHeader(AS2Header.RECEIPT_DELIVERY_OPTION, partnershipDVO.getRecipientAddress());
    as2Msg.setHeader(AS2Header.DISPOSITION_NOTIFICATION_TO, partnershipDVO.getReceiptAddress());

      DispositionNotificationOptions dnos = new DispositionNotificationOptions();
         DispositionNotificationOption option = dnos.addOption(DispositionNotificationOptions.SIGNED_RECEIPT_PROTOCOL);
         option.addValue(DispositionNotificationOption.SIGNED_RECEIPT_PROTOCOL_PKCS7);
         option = dnos.addOption(DispositionNotificationOptions.SIGNED_RECEIPT_MICALG);
         option.addValue(SMIMESignedGenerator.DIGEST_SHA1);
         as2Msg.setHeader(AS2Header.DISPOSITION_NOTIFICATION_OPTIONS, option.toString());

    // Set Content to Message
    InputStream ins = FIXTURE_LOADER.getResourceAsStream(MOCK_AS2_MSG);
    ByteArrayInputStream bIns = new ByteArrayInputStream(IOHandler.readBytes(ins));
    as2Msg.setContent(new InputStreamDataSource(bIns, "xml", MOCK_AS2_MSG), "application/XML");
    as2Message = as2Msg;

    // Initilaize Keystore-Manager
    keyMan = (KeyStoreManager)TARGET.getComponent(COMPONENT_KEYSTORE_MANAGER);
}
项目:hermes    文件:OutgoingMessageProcessorTest.java   
@Override
public void setUp() throws Exception {
    commitSQL(MessageDAO.class, CREATE_TABLE_SQL);

    //Prepare the Partnership DVO
    partnershipDAO = (PartnershipDAO) TARGET.getDAOFactory().createDAO(PartnershipDAO.class);
    partnershipDVO = (PartnershipDVO) partnershipDAO.createDVO();
    partnershipDVO.setPartnershipId("OutgoingMessageProcessorTest_P1");
    partnershipDVO.setIsDisabled(false);
    partnershipDVO.setAs2From("as2Form");
    partnershipDVO.setAs2To("as2To");
    partnershipDVO.setSubject("OutgoingMessageProcessor Unit Test");
    partnershipDVO.setIsSyncReply(false);
    partnershipDVO.setReceiptAddress("http://127.0.0.1:8080/corvus/httpd/as2/inbound");
    partnershipDVO.setRecipientAddress("http://127.0.0.1:8080/corvus/httpd/as2/inbound");
    partnershipDVO.setIsReceiptRequired(false);

    partnershipDVO.setIsReceiptSignRequired(true);
    partnershipDVO.setIsInboundEncryptRequired(false);
    partnershipDVO.setIsInboundSignRequired(false);

    partnershipDVO.setIsOutboundCompressRequired(false);
    partnershipDVO.setIsOutboundEncryptRequired(false);
    partnershipDVO.setIsOutboundSignRequired(false);

    partnershipDVO.setSignAlgorithm(PartnershipDVO.ALG_SIGN_SHA1);
    partnershipDVO.setEncryptAlgorithm(PartnershipDVO.ALG_ENCRYPT_3DES);
    partnershipDVO.setMicAlgorithm(PartnershipDVO.ALG_MIC_SHA1);

    partnershipDVO.setVerifyCert(IOHandler.readBytes(FIXTURE_LOADER.getResourceAsStream("security/corvus.cer")));
    partnershipDVO.setEncryptCert(IOHandler.readBytes(FIXTURE_LOADER.getResourceAsStream("security/corvus.cer")));
    partnershipDAO.create(partnershipDVO);

    //Seting Mail Cap
    MailcapCommandMap mailcaps = new MailcapCommandMap();
    mailcaps.addMailcap("application/pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_signature");
    mailcaps.addMailcap("application/pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.pkcs7_mime");
    mailcaps.addMailcap("application/x-pkcs7-signature;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_signature"); 
    mailcaps.addMailcap("application/x-pkcs7-mime;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.x_pkcs7_mime");
    mailcaps.addMailcap("multipart/signed;; x-java-content-handler=org.bouncycastle.mail.smime.handlers.multipart_signed");
    mailcaps.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");

    mailcaps.addMailcap("application/deflate;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("message/disposition-notification;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/EDI-X12;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/EDIFACT;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/edi-consent;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/XML;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    mailcaps.addMailcap("application/octet-stream;; x-java-content-handler=hk.hku.cecid.piazza.commons.activation.ByteStreamDataContentHandler");
    CommandMap.setDefaultCommandMap(mailcaps);
}
项目:jdk8u_jdk    文件:MailTest.java   
static void workaroundJAFSetup() {
    MailcapCommandMap mailMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
    mailMap.addMailcap("multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
}