[seam-commits] Seam SVN: r9715 - trunk/src/main/org/jboss/seam/intercept.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Dec 4 03:00:42 EST 2008
Author: dan.j.allen
Date: 2008-12-04 03:00:42 -0500 (Thu, 04 Dec 2008)
New Revision: 9715
Modified:
trunk/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java
Log:
allow callbacks to HttpSessionActivationListener implementations to proceed (sessionWillPassivate, sessionDidActivate)
Modified: trunk/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java 2008-12-04 07:57:58 UTC (rev 9714)
+++ trunk/src/main/org/jboss/seam/intercept/JavaBeanInterceptor.java 2008-12-04 08:00:42 UTC (rev 9715)
@@ -6,6 +6,7 @@
import javassist.util.proxy.MethodHandler;
import javassist.util.proxy.ProxyObject;
+import javax.servlet.http.HttpSessionActivationListener;
import javax.servlet.http.HttpSessionEvent;
import org.jboss.seam.Component;
@@ -70,12 +71,12 @@
if ( "sessionDidActivate".equals(methodName) )
{
callPostActivate();
- return null;
+ return (bean instanceof HttpSessionActivationListener) ? method.invoke(bean, params) : null;
}
else if ( "sessionWillPassivate".equals(methodName) )
{
callPrePassivate();
- return null;
+ return (bean instanceof HttpSessionActivationListener) ? method.invoke(bean, params) : null;
}
}
}
@@ -118,12 +119,18 @@
private void callPostConstruct()
{
- InvocationContext context = new RootInvocationContext( bean, getComponent().getPostConstructMethod(), new Object[0] )
+ final Component component = getComponent();
+ if (!component.hasPostConstructMethod())
{
+ return;
+ }
+
+ InvocationContext context = new RootInvocationContext( bean, component.getPostConstructMethod(), new Object[0] )
+ {
@Override
public Object proceed() throws Exception
{
- getComponent().callPostConstructMethod(bean);
+ component.callPostConstructMethod(bean);
return null;
}
@@ -133,12 +140,18 @@
private void callPrePassivate()
{
- InvocationContext context = new RootInvocationContext( bean, getComponent().getPrePassivateMethod(), new Object[0] )
+ final Component component = getComponent();
+ if (!component.hasPrePassivateMethod())
{
+ return;
+ }
+
+ InvocationContext context = new RootInvocationContext( bean, component.getPrePassivateMethod(), new Object[0] )
+ {
@Override
public Object proceed() throws Exception
{
- getComponent().callPrePassivateMethod(bean);
+ component.callPrePassivateMethod(bean);
return null;
}
@@ -148,12 +161,18 @@
private void callPostActivate()
{
- RootInvocationContext context = new RootInvocationContext(bean, getComponent().getPostActivateMethod(), new Object[0])
+ final Component component = getComponent();
+ if (!component.hasPostActivateMethod())
{
+ return;
+ }
+
+ RootInvocationContext context = new RootInvocationContext(bean, component.getPostActivateMethod(), new Object[0])
+ {
@Override
public Object proceed() throws Exception
{
- getComponent().callPostActivateMethod(bean);
+ component.callPostActivateMethod(bean);
return null;
}
More information about the seam-commits
mailing list