nl.gx.webmanager.handler.forms.handling
Class MailBody

java.lang.Object
  extended by nl.gx.webmanager.handler.forms.handling.MailBody

public class MailBody
extends java.lang.Object

Utility class for the MailHandler for building a HTML email MIME parts.


Constructor Summary
MailBody(java.lang.String targetURL, boolean textversion, boolean embedHtmlFlag)
          Constructor
 
Method Summary
 void createAttachmentsForCids(java.util.List attachmentParts)
          Replace the ... tags by cid:...
 void createCids()
          Surround all links to images and stylesheets with ...
 java.lang.String getBody()
          Get the body text for the email
 java.lang.String getContentType()
          Get the MIME content type of this body
static javax.activation.DataSource getDataSource(java.net.URL url)
          Creates a datasource representing the contents for a url.
 void includeStylesheets()
          Include external stylesheets into the body.
 void removeJavaScript()
          Remove the Javascript from the body of the mail
 void retrieveBodyFromUrl(java.lang.String pageURL, javax.servlet.http.Cookie[] cookies)
          Deprecated. this method does not contain the fix for sending personalized mail without having a JSession cookie on the client.
 void retrieveBodyFromUrl(java.lang.String pageURL, javax.servlet.http.Cookie[] cookies, javax.servlet.http.HttpServletRequest request)
          Return the body text from the pointer page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MailBody

public MailBody(java.lang.String targetURL,
                boolean textversion,
                boolean embedHtmlFlag)
Constructor

Parameters:
targetURL - the url of the page to be fetched and used as the email body text.
textversion - if true then the email will be in plain text, otherwise HTML is used.
embedHtmlFlag - if true then all images needed to display the HTML message will be embedded in the mail.
Method Detail

retrieveBodyFromUrl

public void retrieveBodyFromUrl(java.lang.String pageURL,
                                javax.servlet.http.Cookie[] cookies,
                                javax.servlet.http.HttpServletRequest request)
                         throws java.net.MalformedURLException,
                                java.io.IOException
Return the body text from the pointer page.

Parameters:
pageURL -
cookies -
Throws:
java.net.MalformedURLException
java.io.IOException

retrieveBodyFromUrl

public void retrieveBodyFromUrl(java.lang.String pageURL,
                                javax.servlet.http.Cookie[] cookies)
                         throws java.net.MalformedURLException,
                                java.io.IOException
Deprecated. this method does not contain the fix for sending personalized mail without having a JSession cookie on the client.

Return the body text from the pointer page.

Parameters:
pageURL -
cookies -
Throws:
java.net.MalformedURLException
java.io.IOException

removeJavaScript

public void removeJavaScript()
Remove the Javascript from the body of the mail


createCids

public void createCids()
Surround all links to images and stylesheets with ...


includeStylesheets

public void includeStylesheets()
Include external stylesheets into the body. So replace with


createAttachmentsForCids

public void createAttachmentsForCids(java.util.List attachmentParts)
Replace the ... tags by cid:... and create attachment parts for the referenced resources

Parameters:
attachmentParts - the generated MimeBodyPart objects will be added to this list.

getBody

public java.lang.String getBody()
Get the body text for the email

Returns:
the body text

getContentType

public java.lang.String getContentType()
Get the MIME content type of this body

Returns:
text/plain for text, text/html for html

getDataSource

public static javax.activation.DataSource getDataSource(java.net.URL url)
                                                 throws java.io.IOException
Creates a datasource representing the contents for a url.

Parameters:
url - The url for which the contents should be retrieved.
Returns:
A datasource containing the content and contenttype for the url argument.
Throws:
java.io.IOException - If a read error occurred or the responsecode of the webserver is not 200 (OK).


Copyright © 2007-2011 GX Software BV. All Rights Reserved.