|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rakeshv.mail.SendHandler
public class SendHandler
This class handles multipart/form-data encoded form
posts from the write.jsp page that is used
to compose email messages. This class parses out the message
attributes, as well as all the attachments added to the message
from the HttpServletRequest.
Copyright 2003, Rakesh Vidyadharan
| Field Summary | |
|---|---|
private AddressBook |
addressBook
The AddressBook object for
the current user. |
private javax.mail.Folder |
folder
The Folder which the user is viewing at present. |
private WriteFormParser |
formParser
The WriteFormParser class that is used to parse out the
form parts and elements from the HttpRequest. |
private javax.mail.Message |
message
The Message object that is to be created with all
the attributes and parts specified in the form post. |
private javax.mail.Session |
session
The web session for the user using the webmail service. |
| Constructor Summary | |
|---|---|
protected |
SendHandler()
Default constructor. |
|
SendHandler(javax.mail.Folder folder,
AddressBook addressBook,
WriteFormParser formParser,
javax.mail.Session session)
Creates an instance of the handler, and sets the instance fields to the passed in values. |
| Method Summary | |
|---|---|
javax.mail.Message |
createMessage()
Creates the appropriate type of message. |
javax.mail.Message |
createMessage(javax.mail.Message currentMessage)
Creates the appropriate type of message for forwarded mail. |
private void |
setBcc()
Set the bcc attribute for the message. |
private void |
setBodyWithAttachments()
Set the body parts for the reply. |
private void |
setCc()
Set the cc attribute for the message. |
private void |
setDate()
Set the date attribute for the message. |
private void |
setForwardBody(javax.mail.Message originalMessage)
Set the body parts for the forwarded message. |
private void |
setFrom()
Set the from attribute of the new message. |
private void |
setMessageAttributes()
Set the common attributes for the message. |
private void |
setMessageBody()
Sets the various body parts for the message. |
private void |
setSubject()
Set the subject attribute for the message. |
private void |
setTo()
Set the to attribute of the new message. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private javax.mail.Session session
private javax.mail.Folder folder
Folder which the user is viewing at present.
This is used to determine if the new message being created is
a reply to an existing message or not.
private AddressBook addressBook
AddressBook object for
the current user.
private WriteFormParser formParser
WriteFormParser class that is used to parse out the
form parts and elements from the HttpRequest.
private javax.mail.Message message
Message object that is to be created with all
the attributes and parts specified in the form post.
| Constructor Detail |
|---|
protected SendHandler()
public SendHandler(javax.mail.Folder folder,
AddressBook addressBook,
WriteFormParser formParser,
javax.mail.Session session)
folder - - The mail folder that the user is currently
viewing. See folder.addressBook - - The user's address book. See
addressBook.formParser - - The parsed contents of the
form. The WriteFormParser.parseFormData() method
must have been invoked prior to initialising this class.session - - The web session. See session.| Method Detail |
|---|
public javax.mail.Message createMessage()
throws javax.mail.MessagingException,
java.io.IOException
WriteFormParser and creates the new Message.
If no attachments were specified in the form post,
a "text/plain" message is created, otherwise a "multipart/mixed"
message is created.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
java.io.IOException - - If errors are encountered while setting
the body of the message.createMessage( Message )
public javax.mail.Message createMessage(javax.mail.Message currentMessage)
throws javax.mail.MessagingException,
java.io.IOException
WriteFormParser and creates the new
Message. This method also attaches any attachments
that were originally part of the specified message to the new
message being composed.
currentMessage - - The WebMailBean.currentMessage that is being forwarded.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
java.io.IOException - - If errors are encountered while setting
the body of the message.
private void setMessageAttributes()
throws javax.mail.MessagingException
message. The common
attributes set are from, to, cc, bcc, subject.
The attributes are fetched from the HttpServetRequest
and added to the new message. Simply calls the appropriate
methods for setting the attributes.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.setFrom(),
setTo(),
setCc(),
setBcc(),
setSubject()
private void setFrom()
throws javax.mail.MessagingException
from attribute of the new message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setTo()
throws javax.mail.MessagingException
to attribute of the new message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setCc()
throws javax.mail.MessagingException
cc attribute for the message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setBcc()
throws javax.mail.MessagingException
bcc attribute for the message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setSubject()
throws javax.mail.MessagingException
subject attribute for the message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setDate()
throws javax.mail.MessagingException
date attribute for the message.
javax.mail.MessagingException - - If any exceptions are encountered
while creating the new message.
private void setMessageBody()
throws javax.mail.MessagingException,
java.io.IOException
message. If no
attachments were included in the form post, or if no attachments
were associated with the message to which this new message is a
reply to, then a plain-text message will be created. Otherwise,
a message with multiple body parts will be created.
javax.mail.MessagingException - - If errors are encountered while
setting the message body.
java.io.IOException - - If errors are encountered while fetching
the content from the existing message.setBodyWithAttachments()
private void setForwardBody(javax.mail.Message originalMessage)
throws javax.mail.MessagingException,
java.io.IOException
originalMessage - - The message which is being
forwarded.
javax.mail.MessagingException - - If errors are encountered while
adding the body to the reply message.
java.io.IOException - - If errors are encountered while fetching
the content from the existing message.
private void setBodyWithAttachments()
throws javax.mail.MessagingException,
java.io.IOException
javax.mail.MessagingException - - If errors are encountered while
setting the body of the new message.
java.io.IOException
|
Rakesh API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||