|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmailreader2.ApplicationListener
public final class ApplicationListener
ServletContextListener that initializes and finalizes the
persistent storage of User and Subscription information for the Struts
Demonstration Application, using an in-memory database backed by an XML
file.
IMPLEMENTATION WARNING - If this web application is run from a WAR file, or in another environment where reading and writing of the web application resource is impossible, the initial contents will be copied to a file in the web application temporary directory provided by the container. This is for demonstration purposes only - you should NOT assume that files written here will survive a restart of your servlet container.
This class was borrowed from the Shale Mailreader. Changes were:
DEVELOPMENT NOTE - Another approach would be to instantiate the database via Spring.
| Field Summary | |
|---|---|
static String |
DATABASE_KEY
Appication scope attribute key under which the in-memory version of our database is stored. |
static String |
PROTOCOLS_KEY
Application scope attribute key under which the valid selection items for the protocol property is stored. |
| Constructor Summary | |
|---|---|
ApplicationListener()
|
|
| Method Summary | |
|---|---|
void |
contextDestroyed(javax.servlet.ServletContextEvent event)
Gracefully shut down this database, releasing any resources that were allocated at initialization. |
void |
contextInitialized(javax.servlet.ServletContextEvent event)
Initialize and load our initial database from persistent storage. |
String |
getPathname()
Return the application resource path to the database. |
void |
setPathname(String pathname)
Set the application resource path to the database. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String DATABASE_KEY
Appication scope attribute key under which the in-memory version of our database is stored.
public static final String PROTOCOLS_KEY
Application scope attribute key under which the valid selection items for the protocol property is stored.
| Constructor Detail |
|---|
public ApplicationListener()
| Method Detail |
|---|
public String getPathname()
Return the application resource path to the database.
public void setPathname(String pathname)
Set the application resource path to the database.
pathname - to the databasepublic void contextDestroyed(javax.servlet.ServletContextEvent event)
Gracefully shut down this database, releasing any resources that were allocated at initialization.
contextDestroyed in interface javax.servlet.ServletContextListenerevent - ServletContextEvent to processpublic void contextInitialized(javax.servlet.ServletContextEvent event)
Initialize and load our initial database from persistent storage.
contextInitialized in interface javax.servlet.ServletContextListenerevent - The context initialization event
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||