cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject svn commit: r225800 - in /cocoon: blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java trunk/status.xml
Date Thu, 28 Jul 2005 15:25:50 GMT
Author: sylvain
Date: Thu Jul 28 08:25:45 2005
New Revision: 225800

URL: http://svn.apache.org/viewcvs?rev=225800&view=rev
Log:
Fix bug #35618

Modified:
    cocoon/blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
    cocoon/trunk/status.xml

Modified: cocoon/blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java?rev=225800&r1=225799&r2=225800&view=diff
==============================================================================
--- cocoon/blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
(original)
+++ cocoon/blocks/mail/trunk/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
Thu Jul 28 08:25:45 2005
@@ -17,7 +17,6 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
@@ -27,7 +26,6 @@
 
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
-import javax.activation.URLDataSource;
 import javax.mail.Address;
 import javax.mail.BodyPart;
 import javax.mail.Message;
@@ -45,6 +43,7 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.mail.datasource.SourceDataSource;
 import org.apache.cocoon.transformation.AbstractSAXTransformer;
 import org.apache.excalibur.source.Source;
 import org.xml.sax.Attributes;
@@ -256,7 +255,6 @@
     protected int defaultSmtpPort;
     protected String defaultFromAddress;
 
-    protected boolean useExternalRequests = true;
     protected List    usedSources = new ArrayList();
 
     /**
@@ -275,7 +273,6 @@
         this.defaultSmtpHost = configuration.getChild("smtphost").getValue("");
         this.defaultSmtpPort = configuration.getChild("smtpport").getValueAsInteger(25);
         this.defaultFromAddress = configuration.getChild("from").getValue("");
-        this.useExternalRequests = configuration.getChild("use-external-requests").getValueAsBoolean(this.useExternalRequests);
     }
 
     /**
@@ -584,40 +581,14 @@
                 Source inputSource = null;
                 DataSource dataSource = null;
 
-                if (aD.isURLSource()) {
-                    inputSource = resolver.resolveURI(aD.strAttrSrc);
-                    this.usedSources.add(inputSource);
-
-                    String iSS = inputSource.getURI();
-                    if (iSS.startsWith("cocoon:") && this.useExternalRequests) {
-                        iSS = iSS.substring(7, iSS.length());
-
-                        if (this.contextPath != null) {
-                            iSS = "http://localhost:" + this.port +
-                                  this.contextPath + iSS;
-                        } else {
-                            iSS = "http://localhost:" + this.port + iSS;
-                        }
-
-                        if (getLogger().isDebugEnabled()) {
-                            getLogger().debug("cocoon-URI changed to " + iSS);
-                        }
-
-                        dataSource = new URLDataSource(new URL(iSS));
-                    } else {
-                        dataSource = new URLDataSource(new URL(inputSource.getURI()));
-                    }
+                inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
+                this.usedSources.add(inputSource);
+                
+                dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);
 
-                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
-                } else if (aD.isFileSource()) {
-                    inputSource = resolver.resolveURI(aD.strAttrFile);
-                    this.usedSources.add(inputSource);
-                    dataSource  = new URLDataSource(new URL(inputSource.getURI()));
-                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
-                }
+                messageBodyPart.setDataHandler(new DataHandler(dataSource));
             } else {
-                messageBodyPart.setContent(aD.strContent,
-                                           aD.strAttrMimeType);
+                messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
             }
 
             messageBodyPart.setFileName(aD.strAttrName);

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=225800&r1=225799&r2=225800&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Thu Jul 28 08:25:45 2005
@@ -509,6 +509,10 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="SW" type="fix" fixes-bug="35618" due-to="Philippe Gassmann" due-to-email="phil@anyware-tech.com">
+      Mail block: Allow any of the Cocoon-provided protocols to be used for attachments in
SendMailTransformer.
+      This means that "cocoon:" URLs are no more rewritten as external http requests.
+    </action>
     <action dev="CZ" type="add" fixes-bug="35521" due-to="Mark Lundquist" due-to-email="mlundquist2@comcast.net">
       Added the create-document source than either generates empty documents or documents
containing
       just a root node.



Mime
View raw message