dims 01/09/19 09:07:58
Modified: src/org/apache/cocoon/acting SendmailAction.java
src/org/apache/cocoon/components/language/markup/xsp
XSPRequestHelper.java
src/org/apache/cocoon/components/language/markup/xsp/java
request.xsl
Log:
Patches from "Klaus Bertram" <[EMAIL PROTECTED]> for
- Extend xsp-request with get-attribute-names
- Fix for sendmailAction.
Revision Changes Path
1.7 +7 -8 xml-cocoon2/src/org/apache/cocoon/acting/SendmailAction.java
Index: SendmailAction.java
===================================================================
RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/acting/SendmailAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SendmailAction.java 2001/08/24 12:45:56 1.6
+++ SendmailAction.java 2001/09/19 16:07:58 1.7
@@ -7,13 +7,6 @@
*****************************************************************************/
package org.apache.cocoon.acting;
-import javax.mail.Message;
-import javax.mail.Transport;
-import javax.mail.Session;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.AddressException;
-
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.parameters.Parameters;
@@ -23,6 +16,12 @@
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
+import javax.mail.Message;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
@@ -80,7 +79,7 @@
properties.put("mail.smtp.host",parameters.getParameter("smtphost",null));
getLogger().debug("SendmailAction: overriding default smtp server, using
"+properties.get("mail.smtp.host"));
}
- Session session = Session.getDefaultInstance(properties);
+ Session session = Session.getDefaultInstance(properties,null);
Message message = new MimeMessage(session);
String from = null;
String to = null;
1.9 +26 -1
xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java
Index: XSPRequestHelper.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPRequestHelper.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSPRequestHelper.java 2001/08/20 13:55:11 1.8
+++ XSPRequestHelper.java 2001/09/19 16:07:58 1.9
@@ -23,7 +23,7 @@
* The <code>Request</code> object helper
*
* @author <a href="mailto:[EMAIL PROTECTED]">Ricardo Rocha</a>
- * @version CVS $Revision: 1.8 $ $Date: 2001/08/20 13:55:11 $
+ * @version CVS $Revision: 1.9 $ $Date: 2001/09/19 16:07:58 $
*/
public class XSPRequestHelper {
/**
@@ -366,6 +366,31 @@
return request.getAttribute(name);
}
+ /**
+ * Output attribute names for a given request
+ *
+ * @param objectModel The Map objectModel
+ * @param contentHandler The SAX content handler
+ * @exception SAXException If a SAX error occurs
+ */
+ public static void getAttributeNames(
+ Map objectModel,
+ ContentHandler contentHandler
+ )
+ throws SAXException
+ {
+ Request request = (Request)objectModel.get(Constants.REQUEST_OBJECT);
+ XSPObjectHelper.start(URI, PREFIX, contentHandler, "attribute-names");
+
+ Enumeration e = request.getAttributeNames();
+ while (e.hasMoreElements()) {
+ String name = (String) e.nextElement();
+ XSPObjectHelper.elementData(URI, PREFIX, contentHandler, "name", name);
+ }
+
+ XSPObjectHelper.end(URI, PREFIX, contentHandler, "attribute-names");
+ }
+
/**
* Set the specified attribute
*
1.5 +7 -2
xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/request.xsl
Index: request.xsl
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/request.xsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- request.xsl 2001/08/14 13:59:14 1.4
+++ request.xsl 2001/09/19 16:07:58 1.5
@@ -11,7 +11,7 @@
<!--
* @author <a href="mailto:[EMAIL PROTECTED]>Ricardo Rocha</a>
- * @version CVS $Revision: 1.4 $ $Date: 2001/08/14 13:59:14 $
+ * @version CVS $Revision: 1.5 $ $Date: 2001/09/19 16:07:58 $
-->
<!-- XSP Request logicsheet for the Java language -->
@@ -226,7 +226,12 @@
</xsl:when>
</xsl:choose>
</xsl:template>
-
+ <xsl:template match="xsp-request:get-attribute-names">
+ <xsp:logic>
+ XSPRequestHelper.getAttributeNames(objectModel, this.contentHandler);
+ </xsp:logic>
+ </xsl:template>
+
<xsl:template match="xsp-request:remove-attribute">
<xsl:variable name="name">
<xsl:call-template name="value-for-name"/>
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]