Java Reference
In-Depth Information
When the resource adapter is deployed, it uses the Work Management facilities available
to resource adapters to start a thread that monitors mailbox folders for new messages. The
polling thread of the resource adapter monitors the mailbox folders every 30 seconds for
new messages.
The Message-Driven Bean
The mailconnector message-driven bean, JavaMailMessageBean , activates the
resource adapter. When an MDB is deployed, the application server passes the MDB's
activation config properties (commented out in this case) to the mailconnector re-
source adapter, which forwards it to the polling thread. When the MDB is undeployed, the
application server notifies the resource adapter, which notifies the polling thread to stop
monitoring the mail folder associated with the MDB being undeployed.
The MDB is packaged in an EJB JAR file.
The Web Application
The web application in the mailconnector example contains an HTML page ( in-
dex.html ), Facelets pages, and managed beans that let you log in, send email messages
to a mailbox folder, and query for new messages in a mail folder using the connection in-
terfaces provided by the mailconnector resource adapter.
The application protects the Facelets pages by using form-based authentication, specified
through a security constraint in the web.xml file.
The web application is packaged in a WAR file.
Running the mailconnector Example
You can use either NetBeans IDE or Ant to build, package, deploy, and run the mail-
connector example.
Before You Deploy the mailconnector Example
Before you deploy the mailconnector application, perform the following steps.
1. Download mock-javamail-1.9.jar from
http://download.java.net/maven/2/org/jvnet/mock-javamail/mock-
javamail/1.9/ .
2. Copy this JAR file to the directory as-install /lib .
3. Restart GlassFish Server.
Search WWH ::




Custom Search