Enterprise Technologies

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Leave session open

    1 answers - 1180 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi

    Anybody know how can I leave the session open after retriving the messages from POP3 ?

    this is my code

    Thanks

    Collection mensajesAL = new ArrayList();

    Properties props = System.getProperties();

    Session session = Session.getDefaultInstance(props,null);

    try

    {

    this.setStore(session.getStore("pop3"));

    this.getStore().connect(incomingServer,port,userId,userPwd);

    this.setFolder(store.getFolder("INBOX"));

    this.getFolder().open(Folder.READ_ONLY);

    int cant = this.getFolder().getMessageCount();

    Message message[] = folder.getMessages(from,to);

    for(int i=0 ; i < message.length; i++)

    {

    Email m =new Email();

    //Cargo los mensajes en objetos Email proxy !

    this.message2Email(message,m,1);

    mensajesAL.add(m);

    }

    this.closeFolderAndStore();

    }

    catch(NoSuchProviderException e)

    {

    throw new EmailException("NoSuchProviderException in DAPOPEmail.readInbox()");

    }

    catch(MessagingException e)

    {

    throw new EmailException("Messaging in DAPOPEmail.readInbox()");

    }

    return mensajesAL;

  • No.1 | | 150 bytes | |

    I think you should put your session variable as a private parameter of your class instead of a parameter of your method.hope this helps!

Re: Leave session open


max 4000 letters.
Your nickname that display:
In order to stop the spam: 8 + 7 =
QUESTION ON "Enterprise Technologies"

JAVA TECH