public class WebappLifecycleListener
extends java.lang.Object
Central location for web application lifecycle events.
The main purpose of this class is detect when we
should be invoking methods marked with the
@PreDestroy
annotation.
Modifier and Type | Field and Description |
---|---|
private java.util.List<javax.servlet.http.HttpSession> |
activeSessions |
private ApplicationAssociate |
applicationAssociate |
private static java.util.logging.Logger |
LOGGER |
private javax.servlet.ServletContext |
servletContext |
Constructor and Description |
---|
WebappLifecycleListener() |
WebappLifecycleListener(javax.servlet.ServletContext servletContext) |
Modifier and Type | Method and Description |
---|---|
void |
attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
Notification that an attribute has been removed from a session.
|
void |
attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
Notification that an existing attribute has been removed from the servlet context.
|
void |
attributeRemoved(javax.servlet.ServletRequestAttributeEvent event)
Notification that an existing attribute has been removed from the
servlet request.
|
void |
attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
Notification that an attribute has been replaced in a session.
|
void |
attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
Notification that an attribute on the servlet context has been replaced.
|
void |
attributeReplaced(javax.servlet.ServletRequestAttributeEvent event)
Notification that an attribute was replaced on the
servlet request.
|
void |
contextDestroyed(javax.servlet.ServletContextEvent event)
Notification that the servlet context is about to be shut down.
|
void |
contextInitialized(javax.servlet.ServletContextEvent event)
Notification that the web application initialization
process is starting.
|
java.util.List<javax.servlet.http.HttpSession> |
getActiveSessions() |
private ApplicationAssociate |
getAssociate() |
private void |
handleAttributeEvent(java.lang.String beanName,
java.lang.Object bean,
ELUtils.Scope scope) |
void |
requestDestroyed(javax.servlet.ServletRequestEvent event)
The request is about to go out of scope of the web application.
|
void |
requestInitialized(javax.servlet.ServletRequestEvent event)
The request is about to come into scope of the web application.
|
void |
sessionCreated(javax.servlet.http.HttpSessionEvent event)
Notfication that a session has been created.
|
void |
sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Notification that a session is about to be invalidated.
|
private void |
syncSessionScopedBeans(javax.servlet.ServletRequest request)
This method ensures that session scoped managed beans will be
synchronized properly in a clustered environment.
|
private static final java.util.logging.Logger LOGGER
private javax.servlet.ServletContext servletContext
private ApplicationAssociate applicationAssociate
private java.util.List<javax.servlet.http.HttpSession> activeSessions
public WebappLifecycleListener()
public WebappLifecycleListener(javax.servlet.ServletContext servletContext)
public void requestDestroyed(javax.servlet.ServletRequestEvent event)
event
- the notification eventpublic void requestInitialized(javax.servlet.ServletRequestEvent event)
event
- the notification eventpublic void sessionCreated(javax.servlet.http.HttpSessionEvent event)
event
- the notification eventpublic void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
event
- the notification eventpublic void attributeRemoved(javax.servlet.ServletRequestAttributeEvent event)
event
- the notification eventpublic void attributeReplaced(javax.servlet.ServletRequestAttributeEvent event)
event
- the notification eventpublic void attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
event
- the nofication eventpublic void attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
event
- the notification eventpublic void attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
event
- the notification eventpublic void attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
event
- the notification eventprivate void handleAttributeEvent(java.lang.String beanName, java.lang.Object bean, ELUtils.Scope scope)
public void contextInitialized(javax.servlet.ServletContextEvent event)
event
- the notification eventpublic void contextDestroyed(javax.servlet.ServletContextEvent event)
event
- the nofication eventpublic java.util.List<javax.servlet.http.HttpSession> getActiveSessions()
private ApplicationAssociate getAssociate()
private void syncSessionScopedBeans(javax.servlet.ServletRequest request)
request
- the current ServletRequest
Copyright © 2002-2013 Oracle America, Inc. All Rights Reserved.