站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 .net API Documentation 英文版文档

BaseMailSender (JBoss.Net API) - JBoss 3.2.7 .net API Documentation 英文版文档


org.jboss.net.axis.transport.mailto.client
Class BaseMailSender

java.lang.Object
  extended byorg.apache.axis.handlers.BasicHandler
      extended byorg.jboss.net.axis.transport.mailto.client.BaseMailSender
All Implemented Interfaces:
org.apache.axis.Handler, MailConstants, Serializable
Direct Known Subclasses:
AsyncMailSender, SyncMailSender

public class BaseMailSender
extends org.apache.axis.handlers.BasicHandler
implements MailConstants

Title:
Mail Sender

Description:
This is the Email Transport's Client Side Pivot. This handler manages sending email and attempting to get a response email from the server.
To properly setup this transport you will need a client-deploy.wsdd that contains something like:
  <handler name="MailSender" type="java:org.jboss.net.axis.transport.mail.client.MailSender" >
    <parameter name="username" value="user"/>
    <parameter name="password" value="pass"/>
    <parameter name="timeout" value="120"/>
    <!-- any relavent javamail properties may be set here, these are just an example of some posibilities -->
    <parameter name="mail.store.protocol" value="pop3"/>
    <parameter name="mail.transport.protocol" value="smtp"/>
    <parameter name="mail.host" value="mail.someserver.com"/>
    <parameter name="mail.user" value="user"/>
    <parameter name="mail.from" value="user@someserver.com"/>
    <parameter name="mail.debug" value="false"/>
  </handler>
  <transport name="mail" pivot="MailSender"/>
 
The parameters "username" and "password" are optional. If your mail server doesn't require authentication they can be omitted. The parameter "timeout" is to specify the number of minutes the transport will attempt to retrieve a response from the server. The default is 30 minutes. Any valid Javamail properties may be specified as parameters, and they will be read and used by the transport.

Version:
$Revision: 1.1.4.1 $
Author:
Jason Essington
See Also:
Serialized Form

Field Summary
protected  org.apache.log4j.Logger log
           
static String MAIL_PROPS
           
protected static Properties mailProps
          If a JavaMail session is not stored in jndi, this field will hold the JavaMail properties used to create a session.
protected static String mailSessionName
          The name of a javamail session from jndi that we should use rather than creating a new one.
static String SESSION_NAME
           
static String TRANS_PROPS
           
 
Fields inherited from class org.apache.axis.handlers.BasicHandler
makeLockable, name, options
 
Fields inherited from interface org.jboss.net.axis.transport.mailto.MailConstants
HEADER_CONTENT_TRANSFER_ENCODING, HEADER_CONTENT_TYPE, HEADER_FROM, HEADER_IN_REPLY_TO, HEADER_MESSAGE_ID, HEADER_TO
 
Constructor Summary
BaseMailSender()
           
 
Method Summary
protected  void archiveMessage(String msgID, org.apache.axis.MessageContext msgCtx)
          Override this method if you need to store outgoing messages.
Note: If web service security handlers are in the handler chain, the message will be signed/encrypted here.
protected  void checkResponse(org.apache.axis.MessageContext ctx)
          Override this method if you want the client to block until it recieves a response.
In reality, this is probably only usefull for testing since email is not really a synchronous operation.
protected  Properties getJavaMailProperties()
          This handler expects the JavaMail properties to be specified in the wsdd (if no SessionName is set).
protected  javax.mail.Session getMailSession()
          Fetch a mail session.
 void invoke(org.apache.axis.MessageContext ctx)
           
protected  String sendMail(org.apache.axis.MessageContext ctx)
           
 
Methods inherited from class org.apache.axis.handlers.BasicHandler
canHandleBlock, cleanup, generateWSDL, getDeploymentData, getName, getOption, getOptions, getUnderstoodHeaders, init, initHashtable, onFault, setName, setOption, setOptionDefault, setOptions, setOptionsLockable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAIL_PROPS

public static final String MAIL_PROPS
See Also:
Constant Field Values

TRANS_PROPS

public static final String TRANS_PROPS
See Also:
Constant Field Values

SESSION_NAME

public static final String SESSION_NAME
See Also:
Constant Field Values

log

protected org.apache.log4j.Logger log

mailProps

protected static Properties mailProps
If a JavaMail session is not stored in jndi, this field will hold the JavaMail properties used to create a session.


mailSessionName

protected static String mailSessionName
The name of a javamail session from jndi that we should use rather than creating a new one.

Constructor Detail

BaseMailSender

public BaseMailSender()
Method Detail

invoke

public void invoke(org.apache.axis.MessageContext ctx)
            throws org.apache.axis.AxisFault
Specified by:
invoke in interface org.apache.axis.Handler
Throws:
org.apache.axis.AxisFault

sendMail

protected String sendMail(org.apache.axis.MessageContext ctx)
                   throws org.apache.axis.AxisFault
Throws:
org.apache.axis.AxisFault

archiveMessage

protected void archiveMessage(String msgID,
                              org.apache.axis.MessageContext msgCtx)
Override this method if you need to store outgoing messages.
Note: If web service security handlers are in the handler chain, the message will be signed/encrypted here.

Parameters:
msgID -
msgCtx -

checkResponse

protected void checkResponse(org.apache.axis.MessageContext ctx)
                      throws org.apache.axis.AxisFault
Override this method if you want the client to block until it recieves a response.
In reality, this is probably only usefull for testing since email is not really a synchronous operation.

Parameters:
ctx -
Throws:
org.apache.axis.AxisFault

getJavaMailProperties

protected Properties getJavaMailProperties()
                                    throws org.apache.axis.AxisFault
This handler expects the JavaMail properties to be specified in the wsdd (if no SessionName is set). If the properties aren't there it will look for a parameter by the name of transport.properties that holds the name of a properties file (to be loaded by the classloader) with the required properties (only javamail properties will be loaded from this file, timeout and authentication information, if included, will be ignored). As a last resort the handler will search the classpath for MailTransportClient.properties. The precidence is transport.properties, properties in the options, then default file.

Returns:
Throws:
org.apache.axis.AxisFault

getMailSession

protected javax.mail.Session getMailSession()
                                     throws org.apache.axis.AxisFault
Fetch a mail session.

Returns:
Session
Throws:
org.apache.axis.AxisFault


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.