Package javax.activation

Examples of javax.activation.MailcapCommandMap


        } else {
            session = Session.getInstance(props, null);
        }

        // add handlers for main MIME types
        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("application/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
        mc.addMailcap("application/soap+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);
       
        session.setDebug(log.isTraceEnabled());
    }
View Full Code Here


        super.init();
        if (getInitParameter("messageString") != null) {
            messageString = getInitParameter("messageString");
        }
       
        MailcapCommandMap mail_cap =
            (MailcapCommandMap) CommandMap.getDefaultCommandMap();

        mail_cap.addMailcap ("message/delivery-status;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
        CommandMap.setDefaultCommandMap (mail_cap);
    }
View Full Code Here

     */
    private void initDefaultCommandMap()
    {
        if (SystemUtils.JAVA_VERSION_FLOAT < 1.6f)
        {
            MailcapCommandMap commandMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
            commandMap.addMailcap("application/xml;;  x-java-content-handler=com.sun.mail.handlers.text_plain");
            commandMap.addMailcap("application/text;; x-java-content-handler=com.sun.mail.handlers.text_plain");
            CommandMap.setDefaultCommandMap(commandMap);
        }
    }
View Full Code Here

   }
  
   private static void registerContentHandler(Class contentHandler)
   {
      DataContentHandler handler;
      MailcapCommandMap mailcap;
     
      try
      {
         mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
         handler = (DataContentHandler) contentHandler.newInstance();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Can not register content handler:" + e.getMessage());
      }
     
      DataFlavor[] flavors = handler.getTransferDataFlavors();
      if (flavors == null)
         return;
     
      for (int i = 0; i < flavors.length; i++)
      {
         DataFlavor flavor = flavors[i];
         String entry = flavor.getMimeType() + ";;" + JAF_CONTENT_HANDLER + "=" + contentHandler.getName();
         mailcap.addMailcap(entry);
      }     
   }
View Full Code Here

   }
  
   private static void registerContentHandler(Class contentHandler)
   {
      DataContentHandler handler;
      MailcapCommandMap mailcap;
     
      try
      {
         mailcap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
         handler = (DataContentHandler) contentHandler.newInstance();
      }
      catch (Exception e)
      {
         throw new RuntimeException("Can not register content handler:" + e.getMessage());
      }
     
      DataFlavor[] flavors = handler.getTransferDataFlavors();
      if (flavors == null)
         return;
     
      for (int i = 0; i < flavors.length; i++)
      {
         DataFlavor flavor = flavors[i];
         String entry = flavor.getMimeType() + ";;" + JAF_CONTENT_HANDLER + "=" + contentHandler.getName();
         mailcap.addMailcap(entry);
      }     
   }
View Full Code Here

                         UserInfo userInfo,
                         String type) throws Exception {
        MimetypesFileTypeMap mimetypes = (MimetypesFileTypeMap) MimetypesFileTypeMap.getDefaultFileTypeMap();
        mimetypes.addMimeTypes( "text/calendar ics ICS" );

        MailcapCommandMap mailcap = (MailcapCommandMap) MailcapCommandMap.getDefaultCommandMap();
        mailcap.addMailcap( "text/calendar;; x-java-content-handler=com.sun.mail.handlers.text_plain" );

        System.out.println( connection );
        Session session = Session.getInstance( connection,
                                               null );
View Full Code Here

     */       
    public static void init() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        if (!initialized) {
            Security.addProvider((Provider)Class.forName(bouncyCastleProviderClassName).newInstance());
           
            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");

            CommandMap.setDefaultCommandMap(mailcap);
           
            initialized = true;
        } else return;
View Full Code Here

     */       
    public static void init() throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        if (!initialized) {
            Security.addProvider((Provider)Class.forName(bouncyCastleProviderClassName).newInstance());
           
            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");

            CommandMap.setDefaultCommandMap(mailcap);
           
            initialized = true;
        } else return;
View Full Code Here

        assertEquals(TextPlainHandler.class.getName(), info.getCommandClass());
    }

    protected void setUp() throws Exception {
        InputStream is = TextPlainHandler.class.getClassLoader().getResourceAsStream("META-INF/mailcap");
        map = new MailcapCommandMap(is);
        is.close();
    }
View Full Code Here

                         UserInfo userInfo,
                         String type) throws Exception {
        MimetypesFileTypeMap mimetypes = (MimetypesFileTypeMap) MimetypesFileTypeMap.getDefaultFileTypeMap();
        mimetypes.addMimeTypes( "text/calendar ics ICS" );

        MailcapCommandMap mailcap = (MailcapCommandMap) MailcapCommandMap.getDefaultCommandMap();
        mailcap.addMailcap( "text/calendar;; x-java-content-handler=com.sun.mail.handlers.text_plain" );

        System.out.println( connection );
        Session session = Session.getInstance( connection,
                                               null );
View Full Code Here

TOP

Related Classes of javax.activation.MailcapCommandMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.