KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > net > axis > transport > mailto > client > MailTransport


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  *
7  * Created on Jan 12, 2004
8  */

9 package org.jboss.net.axis.transport.mailto.client;
10
11 import java.net.MalformedURLException JavaDoc;
12 import java.net.URL JavaDoc;
13
14 import org.apache.axis.AxisEngine;
15 import org.apache.axis.AxisFault;
16 import org.apache.axis.MessageContext;
17 import org.apache.axis.client.Call;
18 import org.apache.axis.client.Transport;
19 //import org.jboss.net.axis.transport.mail.MailConstants;
20

21 /**
22  * <dl>
23  * <dt><b>Title: </b><dd>Mail Transport</dd>
24  * <p>
25  * <dt><b>Description: </b><dd>Client side email transport object. This transport needs at least a recipient and an
26  * action to work properly.</dd>
27  * </dl>
28  * @author <a HREF="mailto:jasone@greenrivercomputing.com">Jason Essington</a>
29  * @version $Revision: 1.1 $
30  */

31 public class MailTransport extends Transport
32 {
33    public static final String JavaDoc DEFAULT_TRANSPORT_NAME = "mailto";
34 // private String toAddress = null;
35
// private String fromAddress = null;
36
// private String action = null;
37

38 // public MailTransport(String recipient, String action, String sender)
39
// {
40
// transportName = DEFAULT_TRANSPORT_NAME;
41
// this.toAddress = recipient;
42
// this.fromAddress = sender;
43
// this.action = action;
44
// }
45

46 // public MailTransport(String recipient, String action)
47
// {
48
// transportName = DEFAULT_TRANSPORT_NAME;
49
// this.toAddress = recipient;
50
// this.action = action;
51
// }
52

53    public MailTransport()
54    {
55       transportName = DEFAULT_TRANSPORT_NAME;
56    }
57
58    /* (non-Javadoc)
59     * @see org.apache.axis.client.Transport#processReturnedMessageContext(org.apache.axis.MessageContext)
60     */

61    public void processReturnedMessageContext(MessageContext context)
62    {
63       // maybe we should do something interesting here.
64
}
65
66    /**
67     *
68     */

69    public void setUrl(String JavaDoc url)
70    {
71       try
72       {
73          URL JavaDoc mailto = new URL JavaDoc(url);
74          this.transportName = mailto.getProtocol();
75 // this.toAddress = mailto.getPath();
76
this.url = mailto.toExternalForm();
77       }
78       catch(MalformedURLException JavaDoc e)
79       {
80          // maybe we should complain or something
81
this.url = url;
82       }
83    }
84    
85    public void setupMessageContextImpl(MessageContext msgCtx, Call call, AxisEngine engine) throws AxisFault
86    {
87       super.setupMessageContextImpl(msgCtx, call, engine);
88
89       // bah! this stuff is now handled by ws-fx/addressing
90
// if (toAddress != null)
91
// msgCtx.setProperty(MailConstants.MC_IMMEDIATE_DESTINATION, toAddress);
92
//
93
// if (fromAddress != null)
94
// msgCtx.setProperty(MailConstants.MC_IMMEDIATE_SENDER, fromAddress);
95

96 // if (action != null)
97
// {
98
// msgCtx.setUseSOAPAction(true);
99
// msgCtx.setSOAPActionURI(this.action);
100
// }
101

102       // if our service has not been set, we will need to set it based upon
103
// the defined SOAPAction otherwise our service handlers will not be run
104
if (msgCtx.getService() == null)
105       {
106          msgCtx.setTargetService(msgCtx.getSOAPActionURI());
107       }
108
109    }
110
111 // public void setRecipient(String recipient)
112
// {
113
// this.toAddress = recipient;
114
// }
115
//
116
// public String getRecipient()
117
// {
118
// return this.toAddress;
119
// }
120
//
121
// public void setSender(String sender)
122
// {
123
// this.fromAddress = sender;
124
// }
125
//
126
// public String getSender()
127
// {
128
// return this.fromAddress;
129
// }
130
//
131
// public void setAction(String action)
132
// {
133
// this.action = action;
134
// }
135
//
136
// public String getAction()
137
// {
138
// return this.action;
139
// }
140

141 }
Popular Tags