KickJava   Java API By Example, From Geeks To Geeks.

Java > Java SE, EE, ME > java > util > Dictionary

java.util
Class Dictionary<K,V>

java.lang.Object
  extended by java.util.Dictionary<K,V>
Direct Known Subclasses:
Hashtable
See Also:
Top Examples, Source Code, Map, Object.equals(java.lang.Object), Object.hashCode()

public Dictionary()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract Enumeration<V> elements()
See Also:
keys()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract V get(Object key)
See Also:
put(java.lang.Object, java.lang.Object), NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract boolean isEmpty()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract Enumeration<K> keys()
See Also:
elements()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract Object put(Object key,
                           Object value)
See Also:
get(java.lang.Object), Object.equals(java.lang.Object), NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


[459]Send mail servlet
By vaishali_tayade { at } rediffmail { dot } com on 2003/10/15 05:59:35  Rate
import java.io.*; 
 import java.util.*; 
 import java.text.*; 
 import javax.mail.*; 
 import javax.servlet.*; 
 import javax.activation.*; 
 import javax.servlet.http.*; 
 import javax.mail.internet.*; 
  
  
 public class WebSMTP extends HttpServlet  {  
    public void service ( HttpServletRequest request, HttpServletResponse response )  throws ServletException, IOException  {  
      try  {  
        Dictionary fields = null; 
        Message msg = new MimeMessage ( Session.getDefaultInstance ( System.getProperties (  ) ,null )  ) ;        
        String f = "vaishali_tayade@rediffmail.com"; 
        Object from =  ( Object )  f; 
        String t = "vaishalitayade@rediffmail.com"; 
        Object to =  ( Object )  t; 
        String c = "vaishali_tayade@yahoo.com"; 
        Object cc =  ( Object )  c; 
        String s = "this is a test mail"; 
        Object subject =  ( Object )  s; 
 System.out.println ( "vaishali 1" ) ; 
        if ( fields == null )   {  
          System.out.println ( "fields is emppty" ) ; 
          fields.put ( "from",from ) ; 
 System.out.println ( "fields = "+fields ) ; 
          fields.put ( "to",to ) ; 
          fields.put ( "subject",subject ) ; 
          fields.put ( "cc",cc ) ; 
          System.out.println ( fields.toString (  )  ) ; 
         }  
        else  {  
          fields.put ( "from",from ) ; 
          fields.put ( "to",to ) ; 
          fields.put ( "subject",subject ) ; 
          fields.put ( "cc",cc ) ; 
          System.out.println ( fields.toString (  )  ) ; 
         }  
        msg.setFrom ( new InternetAddress (  ( String ) fields.get ( "from" )  )  ) ; 
 System.out.println ( "vaishali 2" ) ; 
        InternetAddress [  ]  tos = InternetAddress.parse (  ( String ) fields.get ( "to" )  ) ; 
 System.out.println ( "vaishali 3" ) ; 
        msg.setRecipients ( Message.RecipientType.TO,tos ) ; 
 System.out.println ( "vaishali 4" ) ; 
        /* if ( fields.get ( "cc" )  != null )   {  
          InternetAddress [  ]  ccs = InternetAddress.parse (  ( String ) fields.get ( "cc" )  ) ; 
          msg.setRecipients ( Message.RecipientType.CC,ccs ) ; 
         } */
 
        msg.setSubject (  ( String ) fields.get ( "subject" )  ) ; 
 System.out.println ( "vaishali 5" ) ; 
        msg.setSentDate ( new Date (  )  ) ; 
 System.out.println ( "vaishali 6" ) ; 
        if ( null == fields.get ( "attachment" )  )   {  
 System.out.println ( "vaishali 7" ) ; 
          msg.setText (  ( String ) fields.get ( "body" )  ) ; 
         }  
        else  {  
 System.out.println ( "vaishali 8" ) ; 
          BodyPart body = new MimeBodyPart (  ) ; 
          //attachment =  ( BodyPart ) fields.get ( "attachment" ) ; 
 System.out.println ( "vaishali 9" ) ; 
          body.setText (  ( String ) fields.get ( "body" )  ) ; 
 System.out.println ( "vaishali 10" ) ; 
          MimeMultipart multipart = new MimeMultipart (  ) ; 
 System.out.println ( "vaishali 12" ) ; 
          multipart.addBodyPart ( body ) ; 
 System.out.println ( "vaishali 13" ) ; 
          //multipart.addBodyPart ( attachment ) ; 
          msg.setContent ( multipart ) ; 
 System.out.println ( "vaishali 14" ) ; 
         }  
 System.out.println ( "vaishali 15" ) ; 
        Transport.send ( msg ) ; 
        //printForm ( okForm,request,response ) ; 
       }  
      catch ( Exception e )   {   
  
  
 System.out.println ( "vaishali 16" ) ; 
        System.out.println ( e ) ; 
       }  
     }  
  }  
  
  
  
 


public abstract V put(K key,
                      V value)
See Also:
get(java.lang.Object), Object.equals(java.lang.Object), NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract V remove(Object key)
See Also:
NullPointerException
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  


public abstract int size()
Geek's Notes:
Description  Add your codes or notes  Search More Java Examples  

Popular Tags