public class LifecycleListener extends Object implements javax.servlet.ServletContextAttributeListener, javax.servlet.ServletContextListener, javax.servlet.http.HttpSessionActivationListener, javax.servlet.http.HttpSessionAttributeListener, javax.servlet.http.HttpSessionListener, javax.servlet.ServletRequestAttributeListener, javax.servlet.ServletRequestListener
LifecycleListener implements the lifecycle startup
and shutdown calls (init()
and destroy()
) for
subclasses of AbstractApplicationBean
, AbstractRequestBean
,
and AbstractSessionBean
.
It must be registered with the servlet container as a listener,
through an entry in either the /WEB-INF/web.xml
resource
or a tag library descriptor included in the web application.
Constructor and Description |
---|
LifecycleListener()
Create a new lifecycle listener.
|
Modifier and Type | Method and Description |
---|---|
void |
attributeAdded(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being added.
|
void |
attributeAdded(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being added.
|
void |
attributeAdded(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being added.
|
void |
attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being removed.
|
void |
attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being removed.
|
void |
attributeRemoved(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being removed.
|
void |
attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being replaced.
|
void |
attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being replaced.
|
void |
attributeReplaced(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being replaced.
|
void |
contextDestroyed(javax.servlet.ServletContextEvent event)
Respond to a context destroyed event.
|
void |
contextInitialized(javax.servlet.ServletContextEvent event)
Respond to a context created event.
|
protected void |
fireApplicationDestroy(Object bean)
Fire a destroy event on an @{link AbstractApplicationBean}.
|
protected void |
fireApplicationInit(Object bean)
Fire an init event on an
AbstractApplicationBean . |
protected void |
fireRequestDestroy(Object bean)
Fire a destroy event on an @{link AbstractRequestBean}.
|
protected void |
fireRequestInit(Object bean)
Fire an init event on an
AbstractRequestBean . |
protected void |
fireSessionActivate(Object bean)
Fire an activate event on an @{link AbstractSessionBean}.
|
protected void |
fireSessionDestroy(Object bean)
Fire a destroy event on an @{link AbstractSessionBean}.
|
protected void |
fireSessionInit(Object bean)
Fire an init event on an
AbstractSessionBean . |
protected void |
fireSessionPassivate(Object bean)
Fire an passivate event on an @{link AbstractSessionBean}.
|
protected void |
handleException(javax.faces.context.FacesContext context,
Exception exception)
Handle the specified exception according to the strategy
defined by our current
ExceptionHandler . |
void |
requestDestroyed(javax.servlet.ServletRequestEvent event)
Respond to a request destroyed event.
|
void |
requestInitialized(javax.servlet.ServletRequestEvent event)
Respond to a request created event.
|
void |
sessionCreated(javax.servlet.http.HttpSessionEvent event)
Respond to a session created event.
|
void |
sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Respond to a session destroyed event.
|
void |
sessionDidActivate(javax.servlet.http.HttpSessionEvent event)
Respond to a "session did activate" event.
|
void |
sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)
Respond to a "session will passivate" event.
|
public void contextInitialized(javax.servlet.ServletContextEvent event)
Respond to a context created event. No special processing is required.
contextInitialized
in interface javax.servlet.ServletContextListener
event
- Event to be processedpublic void contextDestroyed(javax.servlet.ServletContextEvent event)
Respond to a context destroyed event. Causes any application
scope attribute that implements AbstractApplicationBean
to be removed, triggering an attributeRemoved()
event.
contextDestroyed
in interface javax.servlet.ServletContextListener
event
- Event to be processedpublic void attributeAdded(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being added. If the
value is an AbstractApplicationBean
, call its
init()
method.
attributeAdded
in interface javax.servlet.ServletContextAttributeListener
event
- Event to be processedpublic void attributeReplaced(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being replaced.
If the old value was an AbstractApplicationBean
, call
its destroy()
method. If the new value is an
AbstractApplicationBean
, call its init()
method.
attributeReplaced
in interface javax.servlet.ServletContextAttributeListener
event
- Event to be processedpublic void attributeRemoved(javax.servlet.ServletContextAttributeEvent event)
Respond to an application scope attribute being removed.
If the old value was an AbstractApplicationBean
, call
its destroy()
method.
attributeRemoved
in interface javax.servlet.ServletContextAttributeListener
event
- Event to be processedpublic void sessionCreated(javax.servlet.http.HttpSessionEvent event)
Respond to a session created event. No special processing is required.
sessionCreated
in interface javax.servlet.http.HttpSessionListener
event
- Event to be processedpublic void sessionDestroyed(javax.servlet.http.HttpSessionEvent event)
Respond to a session destroyed event. Causes any session
scope attribute that implements AbstractSessionBean
to be removed, triggering an attributeRemoved()
event.
sessionDestroyed
in interface javax.servlet.http.HttpSessionListener
event
- Event to be processedpublic void sessionWillPassivate(javax.servlet.http.HttpSessionEvent event)
Respond to a "session will passivate" event. Notify all session
scope attributes that are AbstractSessionBean
s.
sessionWillPassivate
in interface javax.servlet.http.HttpSessionActivationListener
event
- Event to be processedpublic void sessionDidActivate(javax.servlet.http.HttpSessionEvent event)
Respond to a "session did activate" event. Notify all session
scope attributes that are AbstractSessionBean
s.
sessionDidActivate
in interface javax.servlet.http.HttpSessionActivationListener
event
- Event to be processedpublic void attributeAdded(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being added. If the
value is an AbstractSessionBean
, call its
init()
method.
attributeAdded
in interface javax.servlet.http.HttpSessionAttributeListener
event
- Event to be processedpublic void attributeReplaced(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being replaced.
If the old value was an AbstractSessionBean
, call
its destroy()
method. If the new value is an
AbstractSessionBean
, call its init()
method.
attributeReplaced
in interface javax.servlet.http.HttpSessionAttributeListener
event
- Event to be processedpublic void attributeRemoved(javax.servlet.http.HttpSessionBindingEvent event)
Respond to a session scope attribute being removed.
If the old value was an AbstractSessionBean
, call
its destroy()
method.
attributeRemoved
in interface javax.servlet.http.HttpSessionAttributeListener
event
- Event to be processedpublic void requestInitialized(javax.servlet.ServletRequestEvent event)
Respond to a request created event. No special processing is required.
requestInitialized
in interface javax.servlet.ServletRequestListener
event
- Event to be processedpublic void requestDestroyed(javax.servlet.ServletRequestEvent event)
Respond to a request destroyed event. Causes any request
scope attribute that implements AbstractRequestBean
or AbstractFragmentBean
to be removed, triggering an
attributeRemoved()
event.
requestDestroyed
in interface javax.servlet.ServletRequestListener
event
- Event to be processedpublic void attributeAdded(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being added. If the
value is an AbstractRequestBean
, call its init()
method.
attributeAdded
in interface javax.servlet.ServletRequestAttributeListener
event
- Event to be processedpublic void attributeReplaced(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being replaced.
If the old value was an AbstractRequestBean
,
call its destroy()
method. If the new value is an
AbstractRequestBean
, call its init()
method.
attributeReplaced
in interface javax.servlet.ServletRequestAttributeListener
event
- Event to be processedpublic void attributeRemoved(javax.servlet.ServletRequestAttributeEvent event)
Respond to a request scope attribute being removed.
If the old value was an AbstractRequestBean
,
call its destroy()
method.
attributeRemoved
in interface javax.servlet.ServletRequestAttributeListener
event
- Event to be processedprotected void fireApplicationDestroy(Object bean)
Fire a destroy event on an @{link AbstractApplicationBean}.
bean
- AbstractApplicationBean
to fire event onprotected void fireApplicationInit(Object bean)
Fire an init event on an AbstractApplicationBean
.
bean
- AbstractApplicationBean
to fire event onprotected void fireRequestDestroy(Object bean)
Fire a destroy event on an @{link AbstractRequestBean}.
bean
- AbstractRequestBean
to fire event onprotected void fireRequestInit(Object bean)
Fire an init event on an AbstractRequestBean
.
bean
- AbstractRequestBean
to fire event onprotected void fireSessionActivate(Object bean)
Fire an activate event on an @{link AbstractSessionBean}.
bean
- AbstractSessionBean
to fire event onprotected void fireSessionDestroy(Object bean)
Fire a destroy event on an @{link AbstractSessionBean}.
bean
- AbstractSessionBean
to fire event onprotected void fireSessionInit(Object bean)
Fire an init event on an AbstractSessionBean
.
bean
- AbstractSessionBean
to fire event onprotected void fireSessionPassivate(Object bean)
Fire an passivate event on an @{link AbstractSessionBean}.
bean
- AbstractSessionBean
to fire event onprotected void handleException(javax.faces.context.FacesContext context, Exception exception)
Handle the specified exception according to the strategy
defined by our current ExceptionHandler
.
context
- FacesContext for the current requestexception
- Exception to be handledCopyright © 2004-2013 Apache Software Foundation. All Rights Reserved.