Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.chiba.connectors.smtp
Class SMTPSubmissionDriver  view SMTPSubmissionDriver download SMTPSubmissionDriver.java

java.lang.Object
  extended byorg.chiba.xml.xforms.connector.AbstractConnector
      extended byorg.chiba.connectors.smtp.SMTPSubmissionDriver
All Implemented Interfaces:
org.chiba.xml.xforms.connector.Connector, org.chiba.xml.xforms.connector.SubmissionDriver

public class SMTPSubmissionDriver
extends org.chiba.xml.xforms.connector.AbstractConnector
implements org.chiba.xml.xforms.connector.SubmissionDriver

The SMTP submission driver serializes and submits instance data over SMTP (internet mail).

Currently, the driver only supports the post submission method and the replace mode none. Support for form-data-post and urlencoded-post as suggested in 11.2 Submission Options is on the way.

The driver requires the additional information about the SMTP server to use, the mail subject, and the sender. This information has to be provided in the query part of the submission's action URI. If you want the driver to authenticate a user with the SMTP server, just provide a username and a password. Support for other mail header fields like cc may be added later.

Be careful when writing the submission's action URI: First, the contents of the query part have to be URL-encoded, then you have to replace all &'s with their corresponding XML entity & in order to keep the XML well-formed.

Here is an illustrating example:

 <xforms:submission id='smtp' xforms:action='mailto:nn@nowhere.no?server=smtp.nowhere.no&amp;sender=xforms@nowhere.no&amp;subject=instance%20data' />
 
The same example enforcing authentication:
 <xforms:submission id='smtp-auth' xforms:action='mailto:nn@nowhere.no?server=smtp.nowhere.no&amp;sender=xforms@nowhere.no&amp;subject=instance%20data&amp;username=xforms&amp;password=shhh' />
 
Since mail accounts are personal data, there is no example form demonstrating SMTP submission.

Version:
$Id: SMTPSubmissionDriver.java,v 1.5 2003/09/08 12:48:25 joernt Exp $

Nested Class Summary
private  class SMTPSubmissionDriver.SMTPAuthenticator
           
 
Field Summary
private static org.apache.log4j.Category LOGGER
          The logger.
 
Fields inherited from class org.chiba.xml.xforms.connector.AbstractConnector
 
Constructor Summary
SMTPSubmissionDriver()
           
 
Method Summary
private  void send(org.chiba.xml.xforms.Submission submission, org.w3c.dom.Node instance)
           
 java.util.Map submit(org.chiba.xml.xforms.Submission submission, org.w3c.dom.Node instance)
          Serializes and submits the given instance data over the mailto protocol.
 
Methods inherited from class org.chiba.xml.xforms.connector.AbstractConnector
getURI, getURIWithoutFragment, setURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.chiba.xml.xforms.connector.Connector
setURI
 

Field Detail

LOGGER

private static final org.apache.log4j.Category LOGGER
The logger.

Constructor Detail

SMTPSubmissionDriver

public SMTPSubmissionDriver()
Method Detail

submit

public java.util.Map submit(org.chiba.xml.xforms.Submission submission,
                            org.w3c.dom.Node instance)
                     throws org.chiba.xml.xforms.exception.XFormsException
Serializes and submits the given instance data over the mailto protocol.

Specified by:
submit in interface org.chiba.xml.xforms.connector.SubmissionDriver

send

private void send(org.chiba.xml.xforms.Submission submission,
                  org.w3c.dom.Node instance)
           throws java.lang.Exception