You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2008/01/12 01:18:20 UTC
svn commit: r611336 - in /beehive/trunk/netui:
src/pageflow/org/apache/beehive/netui/pageflow/
src/pageflow/org/apache/beehive/netui/pageflow/internal/
test/webapps/drt/src/controls/pfbeancontext/
Author: crogers
Date: Fri Jan 11 16:18:14 2008
New Revision: 611336
URL: http://svn.apache.org/viewvc?rev=611336&view=rev
Log:
Fixes Page Flow + Controls integration issue so that the Control container is initialized correctly for the page flow's onDestroy() method when navigating away from one page flow to another page flow. BEEHIVE-1094.
Tests: BVT and controlsWeb in NetUI (passed on WinXP)
Added:
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java (with props)
Modified:
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java
beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java Fri Jan 11 16:18:14 2008
@@ -601,13 +601,21 @@
}
/**
+ * @deprecated {@link FlowController#destroy(RequestContext, HttpSession)} should be used instead.
+ */
+ void destroy(HttpSession session)
+ {
+ destroy(null, session);
+ }
+
+ /**
* Internal destroy method that is invoked when this object is being removed from the session. This is a
* framework-invoked method; it should not normally be called directly.
*/
- void destroy( HttpSession session )
+ void destroy(RequestContext requestContext, HttpSession session)
{
onDestroy(); // for backwards compatiblity
- super.destroy( session );
+ super.destroy(requestContext, session);
//
// We may have lost our transient ServletContext reference. Try to get the ServletContext reference from the
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java Fri Jan 11 16:18:14 2008
@@ -269,7 +269,7 @@
if ( options == null || ! options.isEnableSelfNesting() )
{
- PageFlowController existing = pfStack.popUntil(request, pageFlowClass, true);
+ PageFlowController existing = pfStack.popUntil(request, response, pageFlowClass, true);
if (existing != null) {
existing.persistInSession(request, response);
@@ -362,7 +362,7 @@
// If (2), we'll use that one (this means that executing an action on a nesting page flow
// while in a nested one will not destroy the nesting page flow only to create a new instance of it).
//
- PageFlowController onStackAlready = pfStack.popUntil( request, retVal.getClass(), false );
+ PageFlowController onStackAlready = pfStack.popUntil(request, response, retVal.getClass(), false);
if ( onStackAlready != null )
{
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java Fri Jan 11 16:18:14 2008
@@ -231,7 +231,7 @@
{
synchronized ( currentPageFlow )
{
- InternalUtils.setCurrentPageFlow( this, request, getServletContext() );
+ InternalUtils.setCurrentPageFlow( this, request, response, getServletContext() );
}
}
//
@@ -239,7 +239,7 @@
//
else
{
- InternalUtils.setCurrentPageFlow( this, request, getServletContext() );
+ InternalUtils.setCurrentPageFlow( this, request, response, getServletContext() );
}
}
@@ -1103,4 +1103,4 @@
void setReturnActionViewRenderer(ViewRenderer returnActionViewRenderer) {
_returnActionViewRenderer = returnActionViewRenderer;
}
-}
\ No newline at end of file
+}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java Fri Jan 11 16:18:14 2008
@@ -18,18 +18,19 @@
*/
package org.apache.beehive.netui.pageflow;
-import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
-import org.apache.beehive.netui.pageflow.handler.Handlers;
-import org.apache.beehive.netui.util.logging.Logger;
-
-import javax.servlet.http.HttpSessionBindingListener;
+import java.io.Serializable;
+import java.lang.reflect.Field;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
import javax.servlet.ServletContext;
-import java.io.Serializable;
-import java.lang.reflect.Field;
+
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
+import org.apache.beehive.netui.pageflow.internal.SessionBindingEvent;
+import org.apache.beehive.netui.util.logging.Logger;
/**
* Base class for Page Flow managed objects (like page flows and JavaServer Faces backing beans).
@@ -96,12 +97,35 @@
}
/**
+ * @deprecated {@link PageFlowManagedObject#destroy(RequestContext, HttpSession)} should be used instead.
+ */
+ void destroy( HttpSession session )
+ {
+ destroy(null, session);
+ }
+
+ /**
* Internal destroy method that is invoked when this object is being removed from the session. This is a
* framework-invoked method; it should not normally be called directly.
*/
- void destroy( HttpSession session )
+ void destroy(RequestContext requestContext, HttpSession session)
{
- onDestroy( session );
+ if (requestContext != null) {
+ HttpServletRequest request = requestContext.getHttpRequest();
+ HttpServletResponse response = requestContext.getHttpResponse();
+ PageFlowControlContainer pfcc = PageFlowControlContainerFactory.getControlContainer(request, session.getServletContext());
+ pfcc.beginContextOnPageFlow(this, request, response, session.getServletContext());
+ try {
+ onDestroy(session);
+ }
+ finally {
+ pfcc.endContextOnPageFlow(this);
+ }
+ }
+ else {
+ onDestroy(session);
+ }
+
JavaControlUtils.uninitJavaControls( session.getServletContext(), this );
}
@@ -151,7 +175,12 @@
{
if ( !_isDestroyed && Handlers.get( servletContext ).getStorageHandler().allowBindingEvent( event ) )
{
- destroy( session );
+ RequestContext requestContext = null;
+ if (event instanceof SessionBindingEvent)
+ {
+ requestContext = ((SessionBindingEvent) event).getRequestContext();
+ }
+ destroy(requestContext, session);
_isDestroyed = true;
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java Fri Jan 11 16:18:14 2008
@@ -18,26 +18,24 @@
*/
package org.apache.beehive.netui.pageflow;
-import org.apache.beehive.netui.util.logging.Logger;
-import org.apache.beehive.netui.util.internal.InternalStringBuilder;
-import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
-import org.apache.beehive.netui.pageflow.internal.InternalConstants;
-import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
-import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor;
-import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptorContext;
+import java.io.Serializable;
+import java.util.Stack;
+import javax.servlet.ServletContext;
+import javax.servlet.http.*;
+
import org.apache.beehive.netui.pageflow.handler.Handlers;
import org.apache.beehive.netui.pageflow.handler.StorageHandler;
+import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor;
+import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptorContext;
+import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.beehive.netui.pageflow.internal.SessionBindingEvent;
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
+import org.apache.beehive.netui.util.logging.Logger;
import org.apache.struts.config.ModuleConfig;
-import javax.servlet.http.HttpSessionBindingListener;
-import javax.servlet.http.HttpSessionBindingEvent;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletContext;
-import java.util.Stack;
-import java.io.Serializable;
-
/**
* <p>
* Stack for keeping track of a series of nested page flows. When a nested page flow is entered,
@@ -46,7 +44,8 @@
* <p>
* This Stack implements the {@link HttpSessionBindingListener} which will receive a callback when
* this is removed from the {@link HttpSession}. At this time, any PageFlowController instances stored
- * on the stack will be destroyed using the {@link PageFlowManagedObject#destroy(javax.servlet.http.HttpSession)}
+ * on the stack will be destroyed using the
+ * {@link PageFlowManagedObject#destroy(RequestContext, HttpSession)}
* lifecycle method.
* </p>
*/
@@ -197,7 +196,7 @@
* @return the last popped page flow if one of the given type was found, or <code>null</code>
* if none was found.
*/
- PageFlowController popUntil( HttpServletRequest request, Class stopAt, boolean onlyIfPresent )
+ PageFlowController popUntil(HttpServletRequest request, HttpServletResponse response, Class stopAt, boolean onlyIfPresent )
{
if (onlyIfPresent && lastIndexOf(stopAt) == -1) {
return null;
@@ -220,7 +219,9 @@
//
// We're discarding the popped page flow. Invoke its destroy() callback, unless it's longLived.
//
- if ( ! popped.isLongLived() ) popped.destroy( request.getSession( false ) );
+ HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart(request);
+ RequestContext rc = new RequestContext(unwrappedRequest, response);
+ if (!popped.isLongLived()) popped.destroy(rc, request.getSession(false));
}
}
@@ -373,8 +374,14 @@
// to be lost. Rehydrate it.
HttpSession session = event.getSession();
if ( session != null ) jpf.reinitialize( null, null, session.getServletContext() );
-
- if ( ! jpf.isLongLived() ) jpf.destroy( event.getSession() );
+
+ if (! jpf.isLongLived()) {
+ RequestContext rc = null;
+ if (event instanceof SessionBindingEvent) {
+ rc = ((SessionBindingEvent) event).getRequestContext();
+ }
+ jpf.destroy(rc, event.getSession());
+ }
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java Fri Jan 11 16:18:14 2008
@@ -55,7 +55,9 @@
HttpServletResponse getHttpResponse()
{
- assert _response instanceof HttpServletResponse : "HttpServletResponse is currently required";
+ if (_response != null) {
+ assert _response instanceof HttpServletResponse : "HttpServletResponse is currently required";
+ }
return ( HttpServletResponse ) _response;
}
}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java Fri Jan 11 16:18:14 2008
@@ -533,8 +533,7 @@
_log.debug( "Popped PageFlowController " + poppedPageFlow + " from the nesting stack" );
}
- InternalUtils.setCurrentPageFlow( poppedPageFlow, request, getServletContext() );
-
+ InternalUtils.setCurrentPageFlow(poppedPageFlow, request, response, getServletContext());
//
// If an ActionInterceptor forwarded to the nested page flow, give it a chance to change the URI as the nested
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java Fri Jan 11 16:18:14 2008
@@ -70,20 +70,6 @@
init( null, null, servletContext );
}
- private static final class SessionBindingEvent
- extends HttpSessionBindingEvent
- {
- public SessionBindingEvent( HttpSession httpSession, String attrName )
- {
- super( httpSession, attrName );
- }
-
- public SessionBindingEvent( HttpSession httpSession, String attrName, Object attrVal )
- {
- super( httpSession, attrName, attrVal );
- }
- }
-
public void setAttribute( RequestContext context, String attrName, Object value )
{
if (_log.isTraceEnabled()) {
@@ -106,7 +92,7 @@
//
if ( currentValue != null && currentValue != value && currentValue instanceof HttpSessionBindingListener )
{
- HttpSessionBindingEvent event = new SessionBindingEvent( session, attrName, currentValue );
+ HttpSessionBindingEvent event = new SessionBindingEvent( context, session, attrName, currentValue );
( ( HttpSessionBindingListener ) currentValue ).valueUnbound( event );
}
@@ -137,7 +123,7 @@
//
if ( currentValue != null && currentValue instanceof HttpSessionBindingListener )
{
- HttpSessionBindingEvent event = new SessionBindingEvent( request.getSession(), attrName, currentValue );
+ HttpSessionBindingEvent event = new SessionBindingEvent( context, request.getSession(), attrName, currentValue );
( ( HttpSessionBindingListener ) currentValue ).valueUnbound( event );
}
@@ -229,7 +215,7 @@
// In order to maintain the single-threaded semantics of PFMO destruction, it's necessary
// to synchronize on PFMO objects here.
//
- HttpSessionBindingEvent event = new SessionBindingEvent(session, attrName, currSessValue);
+ HttpSessionBindingEvent event = new SessionBindingEvent(context, session, attrName, currSessValue);
synchronized(currSessValue) {
((HttpSessionBindingListener)currSessValue).valueUnbound(event);
}
@@ -416,4 +402,4 @@
return map;
}
-}
\ No newline at end of file
+}
Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java Fri Jan 11 16:18:14 2008
@@ -339,10 +339,69 @@
return LONGLIVED_PAGEFLOWS_ATTR_PREFIX + modulePath;
}
+ /**
+ * Set the current {@link PageFlowController} in the user session.
+ *
+ * @param jpf the {@link PageFlowController} to set as the current one in the user session.
+ * @param request
+ * @deprecated Should use {@link #setCurrentPageFlow(PageFlowController, HttpServletRequest, HttpServletResponse, ServletContext)}.
+ */
public static void setCurrentPageFlow( PageFlowController jpf, HttpServletRequest request,
ServletContext servletContext )
{
- setCurrentActionResolver( jpf, request, servletContext );
+ setCurrentPageFlow( jpf, request, null, servletContext );
+ }
+
+ /**
+ * Set the current {@link PageFlowController} in the user session.
+ *
+ * @param jpf the {@link PageFlowController} to set as the current one in the user session.
+ * @param request
+ * @param response
+ * @param servletContext
+ */
+ public static void setCurrentPageFlow(PageFlowController jpf, HttpServletRequest request,
+ HttpServletResponse response, ServletContext servletContext) {
+ StorageHandler sh = Handlers.get(servletContext).getStorageHandler();
+ HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart(request);
+ RequestContext rc = new RequestContext(unwrappedRequest, response);
+ String currentJpfAttrName =
+ ScopedServletUtils.getScopedSessionAttrName(CURRENT_JPF_ATTR, unwrappedRequest);
+ String currentLongLivedJpfAttrName =
+ ScopedServletUtils.getScopedSessionAttrName(CURRENT_LONGLIVED_ATTR, unwrappedRequest);
+
+ //
+ // This case occurs when the previous page flow is no longer active and there is no new page flow
+ //
+ if (jpf == null) {
+ sh.removeAttribute(rc, currentJpfAttrName);
+ sh.removeAttribute(rc, currentLongLivedJpfAttrName);
+ return;
+ }
+
+ //
+ // If this is a long-lived page flow, also store the instance in an attribute that never goes away.
+ //
+ if (jpf.isPageFlow() && isLongLived(jpf.theModuleConfig())) {
+ String longLivedAttrName = getLongLivedFlowAttr(jpf.getModulePath());
+ longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName(longLivedAttrName, unwrappedRequest);
+
+ // Only set this attribute if it's not already there. We want to avoid our onDestroy() callback that's
+ // invoked when the page flow's session attribute is unbound.
+ if (sh.getAttribute(rc, longLivedAttrName) != jpf) {
+ sh.setAttribute(rc, longLivedAttrName, jpf);
+ }
+
+ sh.setAttribute(rc, currentLongLivedJpfAttrName, jpf.getModulePath());
+ sh.removeAttribute(rc, currentJpfAttrName);
+ }
+ //
+ // Default case for removing a previous page flow in the presence of a new page flow.
+ //
+ else {
+ sh.setAttribute(rc, currentJpfAttrName, jpf);
+ sh.removeAttribute(rc, currentLongLivedJpfAttrName);
+ }
}
public static void removeCurrentPageFlow( HttpServletRequest request, ServletContext servletContext )
@@ -689,7 +748,7 @@
* Set the current {@link ActionResolver} (or {@link PageFlowController}) in the user session.
*
* @param resolver the {@link ActionResolver} to set as the current one in the user session.
- * @deprecated Will be removed in the next version.
+ * @deprecated Will be removed in the next version. See {@link #setCurrentPageFlow(PageFlowController, HttpServletRequest, HttpServletResponse, ServletContext)}.
*/
public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request,
ServletContext servletContext )
Added: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java?rev=611336&view=auto
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java (added)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java Fri Jan 11 16:18:14 2008
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * $Header:$
+ */
+package org.apache.beehive.netui.pageflow.internal;
+
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
+
+import org.apache.beehive.netui.pageflow.RequestContext;
+
+public final class SessionBindingEvent extends HttpSessionBindingEvent
+{
+ RequestContext _requestContext;
+
+ public SessionBindingEvent( HttpSession httpSession, String attrName )
+ {
+ super( httpSession, attrName );
+ }
+
+ public SessionBindingEvent( HttpSession httpSession, String attrName, Object attrVal )
+ {
+ super( httpSession, attrName, attrVal );
+ }
+
+ public SessionBindingEvent( RequestContext context, HttpSession httpSession, String attrName, Object attrVal )
+ {
+ this( httpSession, attrName, attrVal );
+ _requestContext = context;
+ }
+
+ public RequestContext getRequestContext()
+ {
+ return _requestContext;
+ }
+}
+
Propchange: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SessionBindingEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java?rev=611336&r1=611335&r2=611336&view=diff
==============================================================================
--- beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java (original)
+++ beehive/trunk/netui/test/webapps/drt/src/controls/pfbeancontext/PageFlowBeanContextController.java Fri Jan 11 16:18:14 2008
@@ -59,9 +59,28 @@
}
protected void onDestroy(HttpSession httpSession) {
- // This check is disabled because of a bug in JPF + Controls integration where the Page Flow
- // runtime doesn't "beginContext" on a ControlContainerContext during JPF destruction.
- // check();
+ // The check() routine can still fail in JPF + Controls
+ // integration because the Page Flow runtime can't do a
+ // "beginContext" on a ControlContainerContext during
+ // JPF destruction.
+ // This only occurs on a Session time out, when there is
+ // no request instance for valid contextual services for
+ // a control in a page flow.
+ if (!sessionExpired(httpSession)) {
+ check();
+ }
+ }
+
+ private boolean sessionExpired(HttpSession session) {
+ boolean result = false;
+ try {
+ // this call will throw IllegalStateException
+ // on an invalidated session
+ session.getLastAccessedTime();
+ } catch (IllegalStateException e) {
+ result = true;
+ }
+ return result;
}
private boolean check() {