org.apache.taglibs.mailer2
Class PartTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended byjavax.servlet.jsp.tagext.BodyTagSupport
          extended byorg.apache.taglibs.mailer2.PartTag
All Implemented Interfaces:
BodyTag, IterationTag, JspTag, Serializable, Tag
Direct Known Subclasses:
MailTag

public class PartTag
extends BodyTagSupport

JSP tag mt:part is used to create a multipart mail. It is used for multipart/alternative HTML and plain text mail alternatives or multipart/digest messages that contain several messages.

It is a child of mt:mail. It can have mt:header and mt:attach tags as children.

Multiple mt:parts can be added to a mt:mail tag. The type attribute of mt:mail should then be one of the multipart/* variants, e.g. multipart/mixed, multipart/related or multipart/alternative. The attachments inside mt:part and its optional body content are assumed to be multipart/related. This enables the creation of HTML formatted e-mail. References to images should be be made using cid: URLs.

Version:
2.0
Author:
Jeroen van Vianen
See Also:
Serialized Form

Field Summary
 Logger log
          Used for logging.
 
Fields inherited from class javax.servlet.jsp.tagext.BodyTagSupport
bodyContent
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
PartTag()
          Default zero-arg constructor.
 
Method Summary
 void addPart(MimeBodyPart mbp)
          Adds an attachment to the list of attachments.
protected  void constructMessage(MimePart part, String type)
          Construct a message and add parts to part.
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 String getBody()
          Returns the body content.
 String getContentType()
          Returns the content-type of this part, possibly including character set.
 String getEncoding()
          Returns the character set for the body content of this part.
 HashMap getHeaders()
          Returns the additional headers set in this part.
 ArrayList getParts()
          Returns the parts that have been added to this part.
 String getType()
          Returns the MIME type of this part.
 void release()
           
 void setBody(String body)
          Sets the body attribute.
 void setEncoding(String encoding)
          Sets the character set for this part.
protected  void setHeader(String name, String value)
          Set the name and value of any extra headers to be set in this part.
 void setType(String type)
          Sets the content-type for this part.
 
Methods inherited from class javax.servlet.jsp.tagext.BodyTagSupport
doInitBody, getBodyContent, getPreviousOut, setBodyContent
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, resetCustomAttributes, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, setPageContext, setParent
 

Field Detail

log

public Logger log
Used for logging.

Constructor Detail

PartTag

public PartTag()
Default zero-arg constructor.

Method Detail

doStartTag

public int doStartTag()
               throws JspException
Throws:
JspException

doAfterBody

public int doAfterBody()
                throws JspException
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
Throws:
JspException

release

public void release()

constructMessage

protected void constructMessage(MimePart part,
                                String type)
                         throws MessagingException
Construct a message and add parts to part.

Parameters:
part - The MimePart to add the parts to
type - The MIME Type of this part, one of "multipart/related", "multipart/mixed", "multipart/alternative", etc if more than one part are to be added.
Throws:
MessagingException - Upon error

addPart

public void addPart(MimeBodyPart mbp)
Adds an attachment to the list of attachments.

Parameters:
mbp - The MimeBodyPart to be added to this part

setHeader

protected void setHeader(String name,
                         String value)
Set the name and value of any extra headers to be set in this part.

Parameters:
name - The name of the header
value - The value of the header

getContentType

public String getContentType()
Returns the content-type of this part, possibly including character set.

Returns:
the content-type

getBody

public String getBody()
Returns the body content.

Returns:
The body content

setBody

public void setBody(String body)
Sets the body attribute.

Parameters:
body - The body content

setEncoding

public void setEncoding(String encoding)
Sets the character set for this part.

Parameters:
encoding - string that is the character set for this email

setType

public void setType(String type)
Sets the content-type for this part.

Parameters:
type - the content-type for this part, e.g. text/plain or multipart/related.

getType

public String getType()
Returns the MIME type of this part.

Returns:
The MIME type

getEncoding

public String getEncoding()
Returns the character set for the body content of this part.

Returns:
The character set

getParts

public ArrayList getParts()
Returns the parts that have been added to this part.

Returns:
The parts

getHeaders

public HashMap getHeaders()
Returns the additional headers set in this part.

Returns:
The headers


Copyright © 2004 Apache Software Foundation, http://jakarta.apache.org/taglibs