io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;
import java.io.FileFilter;
import javax.servlet.ServletContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import javax.mail.Store;
import javax.mail.Session;
CHAPTER 4 n INSTAMAIL: AN AJAX-BASED WEBMAIL CLIENT 177
import javax.mail.Folder;
import javax.mail.Message;
/**
* This class is responsible for getting lists of messages and individual
* messages.
*
* @author
Frank W. Zammetti.
*/
public class MailRetriever {
/**
* Log instance.
*/
private static Log log = LogFactory.getLog(MailRetriever.class);
/**
* This method retrieves the contents of the Inbox.
*
* @param sc ServletContext of the incoming request.
* @return A collection of MessageDTOs.
*/
public Collection getInboxContents(ServletContext sc) {
Collection
messages = new ArrayList();
Folder folder = null;
Store store = null;
try {
// Get the fromAddress from Options.
OptionsDTO options = new OptionsManager().retrieveOptions(sc);
log.info("options = " + options);
String fromAddress = options.getFromAddress();
Properties props = new Properties();
props.
Pages:
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336