You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2011/08/08 01:31:22 UTC

svn commit: r1154799 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5: SymbolConstants.java internal/transform/OnEventWorker.java services/TapestryModule.java

Author: hlship
Date: Sun Aug  7 23:31:21 2011
New Revision: 1154799

URL: http://svn.apache.org/viewvc?rev=1154799&view=rev
Log:
TAP5-1596: Allow the new component id check to be optional, to ease upgrading from 5.2

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java?rev=1154799&r1=1154798&r2=1154799&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java Sun Aug  7 23:31:21 2011
@@ -48,6 +48,7 @@ public class SymbolConstants
      *
      * @deprecated In 5.3, to be removed (along with the support it implies) in 5.4
      */
+    @Deprecated
     public static final String SUPPRESS_REDIRECT_FROM_ACTION_REQUESTS = "tapestry.suppress-redirect-from-action-requests";
 
     /**
@@ -324,4 +325,19 @@ public class SymbolConstants
      * @since 5.3
      */
     public static final String PAGE_SOURCE_ACTIVE_WINDOW = "tapestry.page-cache-active-window";
+
+    /**
+     * The fix for <a href="https://issues.apache.org/jira/browse/TAP5-1596">TAP5-1596</a> means that component ids referenced
+     * by event handler methods (either the nameing convention, or the {@link org.apache.tapestry5.annotations.OnEvent} annotation)
+     * can cause a page load error if there is no matching component in the component's template. Although this is correct behavior,
+     * it can make the upgrade from 5.2 to 5.3 difficult if an existing app had some "left over" event handler methods. Changing
+     * this symbol to {@code false} is a temporary approach to resolving this problem.
+     * <p>
+     * This symbol will be <em>ignored</em> in release 5.4 and removed in 5.5.
+     *
+     * @since 5.3
+     * @deprecated Deprecated in 5.3, a future release will always enforce that component ids referenced by event handler methods actually exist.
+     */
+    @Deprecated
+    public static final String UNKNOWN_COMPONENT_ID_CHECK_ENABLED = "tapestry.compatibility.unknown-component-id-check-enabled";
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java?rev=1154799&r1=1154798&r2=1154799&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/OnEventWorker.java Sun Aug  7 23:31:21 2011
@@ -16,6 +16,7 @@ package org.apache.tapestry5.internal.tr
 
 import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.ValueEncoder;
 import org.apache.tapestry5.annotations.OnEvent;
 import org.apache.tapestry5.annotations.RequestParameter;
@@ -25,6 +26,7 @@ import org.apache.tapestry5.func.Mapper;
 import org.apache.tapestry5.func.Predicate;
 import org.apache.tapestry5.internal.services.ComponentClassCache;
 import org.apache.tapestry5.ioc.OperationTracker;
+import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.ioc.internal.util.TapestryException;
@@ -59,6 +61,8 @@ public class OnEventWorker implements Co
 
     private final OperationTracker operationTracker;
 
+    private final boolean componentIdCheck;
+
     private final InstructionBuilderCallback RETURN_TRUE = new InstructionBuilderCallback()
     {
         public void doBuild(InstructionBuilder builder)
@@ -286,12 +290,16 @@ public class OnEventWorker implements Co
         });
     }
 
-    public OnEventWorker(Request request, ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, OperationTracker operationTracker)
+    public OnEventWorker(Request request, ValueEncoderSource valueEncoderSource, ComponentClassCache classCache, OperationTracker operationTracker,
+
+                         @Symbol(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED)
+                         boolean componentIdCheck)
     {
         this.request = request;
         this.valueEncoderSource = valueEncoderSource;
         this.classCache = classCache;
         this.operationTracker = operationTracker;
+        this.componentIdCheck = componentIdCheck;
     }
 
     public void transform(PlasticClass plasticClass, TransformationSupport support, MutableComponentModel model)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=1154799&r1=1154798&r2=1154799&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Sun Aug  7 23:31:21 2011
@@ -2371,6 +2371,8 @@ public final class TapestryModule
 
         configuration.add(SymbolConstants.PAGE_SOURCE_CHECK_INTERVAL, "5 m");
         configuration.add(SymbolConstants.PAGE_SOURCE_ACTIVE_WINDOW, "15 m");
+
+        configuration.add(SymbolConstants.UNKNOWN_COMPONENT_ID_CHECK_ENABLED, true);
     }
 
     /**