You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/05/21 07:52:51 UTC
svn commit: r171197 - in
/incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow:
NullActionForm.java PageFlowRequestProcessor.java
Author: rich
Date: Fri May 20 22:52:50 2005
New Revision: 171197
URL: http://svn.apache.org/viewcvs?rev=171197&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-750 : default cancel action tried to set form attribute while the form object is null
Added:
incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java (with props)
Modified:
incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
Added: incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java?rev=171197&view=auto
==============================================================================
--- incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java (added)
+++ incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java Fri May 20 22:52:50 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2004 The Apache Software Foundation.
+ *
+ * Licensed 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;
+
+import org.apache.struts.action.ActionForm;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.Collections;
+import java.util.Collection;
+
+
+/**
+ * ActionForm/Map that stores no properties and emits no errors.
+ */
+class NullActionForm extends ActionForm implements Map
+{
+ public int size()
+ {
+ return 0;
+ }
+
+ public boolean isEmpty()
+ {
+ return true;
+ }
+
+ public boolean containsKey( Object key )
+ {
+ return false;
+ }
+
+ public boolean containsValue( Object value )
+ {
+ return false;
+ }
+
+ public Object get( Object key )
+ {
+ return null;
+ }
+
+ public Object put( Object o, Object o1 )
+ {
+ System.err.println( "here" );
+ return null;
+ }
+
+ public Object remove( Object key )
+ {
+ return null;
+ }
+
+ public void putAll( Map map )
+ {
+ }
+
+ public void clear()
+ {
+ }
+
+ public Set keySet()
+ {
+ return Collections.emptySet();
+ }
+
+ public Collection values()
+ {
+ return Collections.emptyList();
+ }
+
+ public Set entrySet()
+ {
+ return Collections.emptySet();
+ }
+}
+
+
Propchange: incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/NullActionForm.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?rev=171197&r1=171196&r2=171197&view=diff
==============================================================================
--- incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Fri May 20 22:52:50 2005
@@ -121,6 +121,8 @@
private static final String REDIRECT_REQUEST_ATTRS_PREFIX = InternalConstants.ATTR_PREFIX + "requestAttrs:";
private static final String REDIRECT_REQUEST_ATTRS_PARAM = "forceRedirect";
private static final String FLOW_CONTROLLER_ACTION_CLASSNAME = FlowControllerAction.class.getName();
+ private static final NullActionForm NULL_ACTION_FORM = new NullActionForm();
+
private Map/*< String, Class >*/ _formBeanClasses = new HashMap/*< String, Class >*/();
private Map/*< String, List< ActionMapping > >*/ _overloadedActions = new HashMap/*< String, List< ActionMapping > >*/();
@@ -379,6 +381,12 @@
//
if ( !alreadyCalledInRequest || form != null )
{
+ //
+ // If this request was forwarded by a button-override of the main form action, then ensure that there are
+ // no databinding errors when the override action does not use a form bean.
+ //
+ if ( form == null && requestWrapper.isForwardedByButton() ) form = NULL_ACTION_FORM;
+
ProcessPopulate.populate( request, response, form, alreadyCalledInRequest );
}
}