Author: jkuhnert
Date: Mon Jan 14 11:48:34 2008
New Revision: 611908
URL: http://svn.apache.org/viewvc?rev=611908&view=rev
Log:
Moved preallocateReservedIds to RequestCycle implementation and removed from
FormSupportImpl as it becomes redunant and unneccessary to do it for each form
rendered. (and really belongs in RequestCycle now anyways since it is the
solve manager of IdAllocator now )
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestListEdit.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestSelectOption.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLComponents.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLStaleSession.xml
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
Mon Jan 14 11:48:34 2008
@@ -28,6 +28,7 @@
import org.apache.tapestry.services.AbsoluteURLBuilder;
import org.apache.tapestry.services.Infrastructure;
import org.apache.tapestry.services.ResponseBuilder;
+import org.apache.tapestry.services.ServiceConstants;
import org.apache.tapestry.util.IdAllocator;
import org.apache.tapestry.util.QueryParameterMap;
import org.apache.tapestry.util.io.CompressedDataEncoder;
@@ -392,9 +393,10 @@
public void renderPage(ResponseBuilder builder)
{
_rewinding = false;
-
+ preallocateReservedIds();
+
try
- {
+ {
_page.renderPage(builder, this);
}
@@ -419,6 +421,19 @@
}
/**
+ * Pre allocates all [EMAIL PROTECTED] ServiceConstants#RESERVED_IDS} so
that none
+ * are used as component or hidden ids as they would conflict with service
+ * parameters.
+ */
+ private void preallocateReservedIds()
+ {
+ for (int i = 0; i < ServiceConstants.RESERVED_IDS.length; i++)
+ {
+ _idAllocator.allocateId(ServiceConstants.RESERVED_IDS[i]);
+ }
+ }
+
+ /**
* Resets all internal state after a render or a rewind.
*/
@@ -666,5 +681,6 @@
public void initializeIdState(String encodedSeed)
{
_idAllocator = IdAllocator.fromExternalString(
CompressedDataEncoder.decodeString(encodedSeed));
+ preallocateReservedIds();
}
}
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
Mon Jan 14 11:48:34 2008
@@ -253,13 +253,6 @@
String sep = "";
boolean hasExtra = false;
- // All the reserved ids, which are essential for
- // dispatching the request, are automatically reserved.
- // Thus, if you have a component with an id of 'service', its element
id
- // will likely be 'service$0'.
-
- preallocateReservedIds();
-
for (int i = 0; i < count; i++)
{
String name = names[i];
@@ -398,7 +391,7 @@
String filteredId = TapestryUtils.convertTapestryIdToNMToken(baseId);
- String result = _cycle.getUniqueId(filteredId);
//_elementIdAllocator.allocateId(filteredId);
+ String result = _cycle.getUniqueId(filteredId);
if (_rewinding)
{
@@ -440,22 +433,14 @@
if (wasPrerendered(comp))
return comp.getClientId();
- return _cycle.peekUniqueId(id); //_elementIdAllocator.peekNextId(id);
+ return _cycle.peekUniqueId(id);
}
public boolean isRewinding()
{
return _rewinding;
}
-
- private void preallocateReservedIds()
- {
- for (int i = 0; i < ServiceConstants.RESERVED_IDS.length; i++)
- {
- _cycle.getUniqueId(ServiceConstants.RESERVED_IDS[i]);
- }
- }
-
+
/**
* Invoked when rewinding a form to re-initialize the _allocatedIds and
_elementIdAllocator.
* Converts a string passed as a parameter (and containing a comma
separated list of ids) back
@@ -479,8 +464,6 @@
// Now, reconstruct the initial state of the
// id allocator.
-
- preallocateReservedIds();
String extraReservedIds = _cycle.getParameter(RESERVED_FORM_IDS);
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestListEdit.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestListEdit.xml?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestListEdit.xml
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestListEdit.xml
Mon Jan 14 11:48:34 2008
@@ -35,7 +35,7 @@
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
<match>name="formids"
value="e,inputColor,inputColor_0,inputColor_1"</match>
- <match>name="seedids"
value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsZm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdQAE4sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxmb3JtJDA="</match>
<match>name="component" value="form"</match>
<match>name="page" value="ListEdit"</match>
<match>name="service" value="direct"</match>
@@ -146,7 +146,7 @@
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
<match>name="formids" value="e"</match>
- <match>name="seedids"
value="BrO0ABXcnACUsU2hlbGwkMCxCb2R5JDAsTGlzdEVkaXRGb3JtJDAsRm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdfAF0sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxMaXN0RWRpdEZvcm0kMCxGb3JtJDA="</match>
<match>name="component" value="$ListEditForm.$Form"</match>
<match>name="page" value="ListEditArray"</match>
<match>name="service" value="direct"</match>
@@ -175,7 +175,7 @@
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
<match>name="formids" value="e"</match>
- <match>name="seedids"
value="BrO0ABXcnACUsU2hlbGwkMCxCb2R5JDAsTGlzdEVkaXRGb3JtJDAsRm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdfAF0sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxMaXN0RWRpdEZvcm0kMCxGb3JtJDA="</match>
<match>name="component" value="$ListEditForm.$Form"</match>
<match>name="page" value="ListEditNull"</match>
<match>name="service" value="direct"</match>
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestSelectOption.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestSelectOption.xml?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestSelectOption.xml
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestSelectOption.xml
Mon Jan 14 11:48:34 2008
@@ -39,7 +39,7 @@
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
<match>name="formids" value="Select"</match>
- <match>name="seedids"
value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsRm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdQAE4sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxGb3JtJDA="</match>
<match>name="component" value="$Form"</match>
<match>name="page" value="Home"</match>
<match>name="service" value="direct"</match>
@@ -129,7 +129,7 @@
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
<match>name="formids" value="Select"</match>
- <match>name="seedids"
value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsRm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdQAE4sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxGb3JtJDA="</match>
<match>name="component" value="$Form"</match>
<match>name="page" value="Two"</match>
<match>name="service" value="direct"</match>
@@ -229,7 +229,7 @@
<!-- Remember the persistent properties? Those made the app go
stateful. -->
<match>name="formids" value="Select"</match>
- <match>name="seedids"
value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsRm9ybSQw"</match>
+ <match>name="seedids"
value="BrO0ABXdQAE4sc2VydmljZSQwLHBhZ2UkMCxjb21wb25lbnQkMCxjb250YWluZXIkMCxzZXNzaW9uJDAsc3AkMCxTaGVsbCQwLEJvZHkkMCxGb3JtJDA="</match>
<match>name="component" value="$Form"</match>
<match>name="page" value="Three"</match>
<match>name="service" value="direct"</match>
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLComponents.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLComponents.xml?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLComponents.xml
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLComponents.xml
Mon Jan 14 11:48:34 2008
@@ -126,7 +126,7 @@
]]>
<match>u,l</match>
<match>0</match>
-
<match><![CDATA[ZH4sIAAAAAAAAAFvzloG1PIMhTcclX8VAJyc/HUSFZOamFgFpz9zE9FQgnZuYmQek/PNcy1LzSoCs4NSSssQiOCPeAMgs9cwrKAVJFqfmpCZDVBWVZSan+mTmZQN5IJMB1AU3oG4AAAA=]]></match>
+
<match><![CDATA[ZH4sIAAAAAAAAAFvzloG1fAHDPJ3i1KKyzORUFQOdgsR0EJWcn1uQn5eaVwJm55UkZualFgHZxanFxZn5eSBWAZBwyQcSOfnpICokMxesxDMXYkQuUA+Q8s9zLYOYE5xaUpZYBGfEGwCZpZ55BaUlYINzUpMhqsBO8cnMywbyQCYDAJ2KEjSmAAAA]]></match>
<match>go</match>
<match>Home</match>
<match>direct</match>
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLStaleSession.xml
URL:
http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLStaleSession.xml?rev=611908&r1=611907&r2=611908&view=diff
==============================================================================
---
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLStaleSession.xml
(original)
+++
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestWMLStaleSession.xml
Mon Jan 14 11:48:34 2008
@@ -66,7 +66,7 @@
<postfield .*?value="(.*?)" />
]]>
<match></match>
-
<match>BrO0ABXcoACYsRG8kMCxTdGFsZVNlc3Npb24kMCxkaXJlY3RMaW5rJDAsZ28kMA==</match>
+
<match>ZH4sIAAAAAAAAAFvzloG1PIEhTqc4tagsMzlVxUCnIDEdRCXn5xbk56XmlYDZeSWJmXmpRUB2cWpxcWZ+HohVACRc8oFEcEliTmowXCIlsyg1ucQnMy8byEkHKgAAGmRtGWYAAAA=</match>
<match>go</match>
<match>Stale</match>
<match>direct</match>