You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/03/31 14:17:58 UTC

svn commit: r524415 - in /webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport: http/HttpTransportProperties.java mail/Constants.java mail/MailTransportSender.java mail/SimpleMailListener.java

Author: saminda
Date: Sat Mar 31 05:17:57 2007
New Revision: 524415

URL: http://svn.apache.org/viewvc?view=rev&rev=524415
Log:
Modified code to support EPR according to http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html, thus, mail 
transport can handle, 
either
mailto:red@localhost?/axis2/services/Foo
or
mailto:red@localhost?X-Service-Path=/axis2/services/Foo

Deprecated the class org.apache.axis2.transport.http.HttpTransportProperties.MailProperties. ava.util.Properties 
should be used instead. This will ease the Client/Server mail transport configuration

TODO : Update the xdoc
TODO : Update the trunk  

Modified:
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java
    webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java?view=diff&rev=524415&r1=524414&r2=524415
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/http/HttpTransportProperties.java Sat Mar 31 05:17:57 2007
@@ -225,6 +225,10 @@
         }
     }
 
+    /**
+     * @deprecated org.apache.axis2.transport.http.HttpTransportProperties.MailProperties has been
+     * deprecated and user are encourage the use of java.util.Properties instead.  
+     */
     public static class MailProperties {
         final Properties mailProperties = new Properties();
 

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java?view=diff&rev=524415&r1=524414&r2=524415
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/Constants.java Sat Mar 31 05:17:57 2007
@@ -75,4 +75,6 @@
     public static final String MAIL_SMTP = "_MAIL_SMTP_";
 
     public static final String MAIL_POP3 = "_MAIL_POP3_";
+
+    public static final String X_SERVICE_PATH = "X-Service-Path";
 }

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java?view=diff&rev=524415&r1=524414&r2=524415
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/MailTransportSender.java Sat Mar 31 05:17:57 2007
@@ -164,7 +164,7 @@
     public void cleanup(MessageContext msgContext) throws AxisFault {
     }
 
-    private void runtimeMailParameterSetting(MessageContext msgContext) {
+    private void mailProperties(MessageContext msgContext) {
         Object obj = msgContext.getProperty(Constants.MAIL_SMTP);
         if (obj != null) {
             // Overide the axis2.xml cofiguration setting
@@ -176,6 +176,10 @@
                 String username = (String) smtpProperties.get(Constants.SMTP_USER);
                 String passwd = props.getPassword();
                 passwordAuthentication = new PasswordAuthentication(username, passwd);
+            } else if (obj instanceof java.util.Properties) {
+                smtpProperties.clear();
+                java.util.Properties props = (java.util.Properties)obj;
+                smtpProperties.putAll(props);
             }
         }
 
@@ -184,7 +188,7 @@
     public void sendMimeMessage(MessageContext msgContext) throws AxisFault {
         try {
             // Override with runtime settings
-            runtimeMailParameterSetting(msgContext);
+            mailProperties(msgContext);
 
             EMailSender sender = new EMailSender();
             sender.setOutputStream(byteArrayOutputStream);
@@ -244,7 +248,7 @@
             email = eprAddress;
         }
 
-        if (eprAddress.indexOf("x-service-path".toLowerCase()) > -1) {
+        if (eprAddress.indexOf(Constants.X_SERVICE_PATH) > -1) {
             index = eprAddress.indexOf('=');
             if (index > -1) {
                 xServicePath = true;
@@ -279,7 +283,6 @@
     }
 
     /**
-     * TODO
      *
      * @param msgContext
      * @return

Modified: webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java?view=diff&rev=524415&r1=524414&r2=524415
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java (original)
+++ webservices/axis2/branches/java/1_2/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java Sat Mar 31 05:17:57 2007
@@ -418,9 +418,14 @@
     }
 
     public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
-        return new EndpointReference[]{new EndpointReference(Constants.TRANSPORT_MAIL + ":" +
-                                                             replyTo + "?" + configurationContext
-                .getServiceContextPath() + "/" + serviceName)};
+        return new EndpointReference[]{
+                new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "?" +
+                                      configurationContext.getServiceContextPath() + "/" +
+                                      serviceName),
+                new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + "?" +
+                                      org.apache.axis2.transport.mail.Constants.X_SERVICE_PATH + "="
+                                      + configurationContext.getServiceContextPath() + "/" +
+                                      serviceName)};
     }
 
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org