You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/06/08 20:19:07 UTC
svn commit: r189616 -
/cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
/cocoon/branches/BRANCH_2_1_X/status.xml
Author: cziegeler
Date: Wed Jun 8 11:19:05 2005
New Revision: 189616
URL: http://svn.apache.org/viewcvs?rev=189616&view=rev
Log:
Mail block: Make internal protocol handling for attachments in SendMailTransformer
configurable and properly release all sources.
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
cocoon/branches/BRANCH_2_1_X/status.xml
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java?rev=189616&r1=189615&r2=189616&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/mail/java/org/apache/cocoon/mail/transformation/SendMailTransformer.java Wed Jun 8 11:19:05 2005
@@ -251,6 +251,9 @@
protected String defaultSmtpHost;
protected String defaultFromAddress;
+ protected boolean useExternalRequests = true;
+ protected List usedSources = new ArrayList();
+
/**
* create a new Transformer
*/
@@ -266,6 +269,7 @@
super.configure(configuration);
this.defaultSmtpHost = configuration.getChild("smtphost").getValue("");
this.defaultFromAddress = configuration.getChild("from").getValue("");
+ this.useExternalRequests = configuration.getChild("use-external-requests").getValueAsBoolean(this.useExternalRequests);
}
/**
@@ -541,6 +545,7 @@
// from variable to build mailbody
if (this.bodyURI != null) {
Source inSrc = resolver.resolveURI(this.bodyURI);
+ this.usedSources.add(inSrc);
InputStream inStr = inSrc.getInputStream();
byte[] byteArr = new byte[inStr.available()];
inStr.read(byteArr);
@@ -567,9 +572,10 @@
if (aD.isURLSource()) {
inputSource = resolver.resolveURI(aD.strAttrSrc);
+ this.usedSources.add(inputSource);
String iSS = inputSource.getURI();
- if (iSS.startsWith("cocoon:")) {
+ if (iSS.startsWith("cocoon:") && this.useExternalRequests) {
iSS = iSS.substring(7, iSS.length());
if (this.contextPath != null) {
@@ -591,6 +597,7 @@
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));
}
@@ -669,6 +676,9 @@
return iaArr;
}
+ /**
+ * @see org.apache.avalon.excalibur.pool.Recyclable#recycle()
+ */
public void recycle() {
this.toAddresses = null;
this.defaultToAddresses = null;
@@ -683,7 +693,13 @@
this.contextPath = null;
this.sendPartial = true;
this.smtpMessage = null;
- super.recycle();
+ final Iterator i = this.usedSources.iterator();
+ while ( i.hasNext() ) {
+ final Source source = (Source)i.next();
+ this.resolver.release(source);
+ }
+ this.usedSources.clear();
+ super.recycle();
}
static class AttachmentDescriptor {
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=189616&r1=189615&r2=189616&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Jun 8 11:19:05 2005
@@ -197,6 +197,10 @@
<changes>
<release version="@version@" date="@date@">
<action dev="CZ" type="update">
+ Mail block: Make internal protocol handling for attachments in SendMailTransformer
+ configurable and properly release all sources.
+ </action>
+ <action dev="CZ" type="update">
Move expires pipeline implementation out of the scratchpad.
</action>
<action dev="CZ" type="add">