HomeDigital EditionSys-Con RadioSearch Java Cd
Advanced Java AWT Book Reviews/Excerpts Client Server Corba Editorials Embedded Java Enterprise Java IDE's Industry Watch Integration Interviews Java Applet Java & Databases Java & Web Services Java Fundamentals Java Native Interface Java Servlets Java Beans J2ME Libraries .NET Object Orientation Observations/IMHO Product Reviews Scalability & Performance Security Server Side Source Code Straight Talking Swing Threads Using Java with others Wireless XML
 

"Using Notification Servers in J2EE Applications"
Vol. 7, Issue 8, p. 18

	


Listing 1

// Set your mail server properties here
Properties props=new Properties();
props.put("mail.host","mailserver.somewhere.com");


// Get a JavaMail session using the mail server
Session session = 
Session.getDefaultInstance(props, null);


// Create the message
Message message = new MimeMessage(session);


// Fill the message
message.setSubject("Claim Assigned");
message.setFrom(
new InternetAddress("[email protected]"));
message.addRecipient(Message.RecipientType.TO,
new InternetAddress("[email protected]"));


String content = "<H1> Please inspect the car and
submit incident report 024199 <H1>";


message.setContent( content,"text/html");


  // Send the message
Transport.send(msg);



Listing 2

<event>
  <recipient domain="cysive.com">jdoe</recipient>
  <message>Claim Assigned to you</message>
  <reference name="RedDot Insurance Inc."/>
  <description>Claim Assigned</description>


  <detail>
    <name>todayDate</name>
    <value>05/24/2002</value>
  </detail>


  <detail>
    <name>Reason</name>
    <value>Please determine repair costs</value>
  </detail>
     
   <detail>
     <name>Claim #</name>
     <value>024199</value>
   </detail>
</event>


Listing 3

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
<xsl:output method="text" version="1.0"
encoding="UTF-8" indent="yes"/>
  <xsl:template match="/">
    <xsl:for-each select="event">
      <xsl:value-of select="message"/>
    </xsl:for-each>
  </xsl:template>
</xsl:stylesheet>

 
 

All Rights Reserved
Copyright ©  2004 SYS-CON Media, Inc.
  E-mail: [email protected]

Java and Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. SYS-CON Publications, Inc. is independent of Sun Microsystems, Inc.