当前位置: 首页>>代码示例>>Java>>正文


Java CommandMap类代码示例

本文整理汇总了Java中javax.activation.CommandMap的典型用法代码示例。如果您正苦于以下问题:Java CommandMap类的具体用法?Java CommandMap怎么用?Java CommandMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommandMap类属于javax.activation包,在下文中一共展示了CommandMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeJavaActivationHandlers

import javax.activation.CommandMap; //导入依赖的package包/类
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.
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:BindingImpl.java

示例2: Mail

import javax.activation.CommandMap; //导入依赖的package包/类
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);
}
 
开发者ID:JonathanImperato,项目名称:Service-Notes,代码行数:26,代码来源:Mail.java

示例3: MailSenderStd

import javax.activation.CommandMap; //导入依赖的package包/类
/**
 * <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");
  }
}
 
开发者ID:demidenko05,项目名称:beige-software,代码行数:24,代码来源:MailSenderStd.java

示例4: setupMailCommandMap

import javax.activation.CommandMap; //导入依赖的package包/类
/**
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);
}
 
开发者ID:cecid,项目名称:hermes,代码行数:20,代码来源:SMIMEHandler.java

示例5: loadMimeMappings

import javax.activation.CommandMap; //导入依赖的package包/类
/**
 * 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.");
  }
}
 
开发者ID:google,项目名称:gdata-java-client,代码行数:28,代码来源:MediaMultipart.java

示例6: init

import javax.activation.CommandMap; //导入依赖的package包/类
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");
}
 
开发者ID:msdx,项目名称:SuperLog,代码行数:22,代码来源:LogMail.java

示例7: Mail

import javax.activation.CommandMap; //导入依赖的package包/类
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); 
}
 
开发者ID:occc-ir,项目名称:cloud_android_client,代码行数:26,代码来源:Mail.java

示例8: Mail

import javax.activation.CommandMap; //导入依赖的package包/类
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); 
}
 
开发者ID:thisisdhaas,项目名称:CookEase,代码行数:26,代码来源:Mail.java

示例9: GMailSender

import javax.activation.CommandMap; //导入依赖的package包/类
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); 
}
 
开发者ID:vocefiscal,项目名称:vocefiscal-android,代码行数:27,代码来源:GMailSender.java

示例10: Mail

import javax.activation.CommandMap; //导入依赖的package包/类
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);
}
 
开发者ID:huchengtw-moz,项目名称:TV-Notification,代码行数:27,代码来源:Mail.java

示例11: Mailer

import javax.activation.CommandMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:phil-brown,项目名称:droidMail,代码行数:29,代码来源:Mailer.java

示例12: setUp

import javax.activation.CommandMap; //导入依赖的package包/类
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);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:23,代码来源:SMIMETestSetup.java

示例13: MailSender

import javax.activation.CommandMap; //导入依赖的package包/类
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);
}
 
开发者ID:KursX,项目名称:Parallator,代码行数:13,代码来源:MailSender.java

示例14: setDefaults

import javax.activation.CommandMap; //导入依赖的package包/类
/**
 * 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);
}
 
开发者ID:cecid,项目名称:hermes,代码行数:18,代码来源:SMimeMessage.java

示例15: initActivationFramework

import javax.activation.CommandMap; //导入依赖的package包/类
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);
}
 
开发者ID:cecid,项目名称:hermes,代码行数:9,代码来源:AS2PlusProcessor.java


注:本文中的javax.activation.CommandMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。