org.apache.taglibs.mailer2
Class AttachTag

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

public class AttachTag
extends BodyTagSupport

JSP tag mt:attach is used to add attachments.

It is a child of mt:mail or mt:part.

Either the url, or the file or both name and type attributes should be present. If the url attribute is present, the name and type are derived from the HTTP response. If the filename attribute is present, the name and type are also automatically derived. If both name and type are present, the body content of the tag is added as an attachment.

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
AttachTag()
          Default zero-arg constructor.
 
Method Summary
 int doAfterBody()
           
 int doEndTag()
           
 int doStartTag()
           
 String getBody()
          Returns the body content.
 String getContentType()
          Returns a complete content-type header with encoding.
 String getEncoding()
          Returns the character set of the body content of this attachment.
 String getFilename()
          Returns the filename of the attachment.
 MimeMessage getMessage()
          Returns the Message object.
 String getName()
          Returns the name of the attachment under which it can be saved.
 String getType()
          Returns the MIME type of the attachment.
 String getUrl()
          Returns the URL of the attachment.
 void release()
           
 void setBody(String body)
          Sets the body attribute.
 void setEncoding(String encoding)
          Sets the encoding attribute.
 void setFilename(String filename)
          Sets the filename attribute.
 void setMessage(MimeMessage message)
          Set an entire Message object as an attachment.
 void setName(String name)
          Sets the name attribute.
 void setType(String type)
          Sets the MIME type for this attachment.
 void setUrl(String url)
          Retrieves the resource indicated by this URL as an attachment.
 
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

AttachTag

public AttachTag()
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()

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

getContentType

public String getContentType()
Returns a complete content-type header with encoding.

Returns:
A Content-Type header

setEncoding

public void setEncoding(String encoding)
Sets the encoding attribute.

Parameters:
encoding - The character set

setFilename

public void setFilename(String filename)
Sets the filename attribute.

Parameters:
filename - The filename to set

setMessage

public void setMessage(MimeMessage message)
Set an entire Message object as an attachment.

Parameters:
message - The Message to attach

setName

public void setName(String name)
Sets the name attribute. This name will be used as the filename to save the attachment.

Parameters:
name - The name of the attachment

setType

public void setType(String type)
Sets the MIME type for this attachment.

Parameters:
type - The MIME type

setUrl

public void setUrl(String url)
Retrieves the resource indicated by this URL as an attachment.

Parameters:
url - full url (including http://), from the resource to be added

getType

public String getType()
Returns the MIME type of the attachment.

Returns:
The MIME type

getUrl

public String getUrl()
Returns the URL of the attachment.

Returns:
The URL

getFilename

public String getFilename()
Returns the filename of the attachment.

Returns:
The filename

getName

public String getName()
Returns the name of the attachment under which it can be saved.

Returns:
The name

getEncoding

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

Returns:
The character set

getMessage

public MimeMessage getMessage()
Returns the Message object.

Returns:
The Message


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