You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2008/01/14 19:33:20 UTC
svn commit: r611881 [1/2] - in
/tapestry/tapestry4/branches/MultipleFormIDGeneration:
tapestry-examples/Vlib/ tapestry-examples/VlibBeans/
tapestry-framework/src/descriptor/META-INF/
tapestry-framework/src/java/org/apache/tapestry/ tapestry-framework/s...
Author: jkuhnert
Date: Mon Jan 14 10:33:16 2008
New Revision: 611881
URL: http://svn.apache.org/viewvc?rev=611881&view=rev
Log:
Implemented first draft of fix for TAPESTRY-1278 && TAPESTRY-1274.
-) Added new "seedids" hidden form field parameter that contains current state of IdAllocator.
-) Refactored FormSupport to use IRequestCycle IdAllocator instance so that all components in the render are guaranteed a unique id.
-) Added toExternalForm and fromExternal to IdAllocator class.
-) Removed all usages of FormSupportFactory as that concept is no longer necessary.
-) Fixed broken pom versions in VLIB/VlibBeans as a result of whoever upped the snapshot version not checking these sub-projects.
-) Added utility class CompressedDataEncoder which works similar to how the pagedataencoder compressed and encodes page data state for inclusion in URLS or hidden form input fields.
-) Made FormSupportImpl re-initialize the RequestCycle IdAllocator instance to the seeded id state that was originally encoded with the form being rewound to gurarantee consistent id state for form submissions.
Added:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java (with props)
Removed:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactory.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportFactoryImpl.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/MultipleFormSupport.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/MultipleFormSupportFactory.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportFactory.java
Modified:
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/Vlib/pom.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/VlibBeans/pom.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/TapestryUtils.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/DirectEventService.java
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/Form.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/services/ServiceConstants.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/GzipUtil.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoMessages.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoStrings.properties
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.jwc
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestFor.xml
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
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/test/org/apache/tapestry/util/TestIdAllocator.java
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/Vlib/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/Vlib/pom.xml?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/Vlib/pom.xml (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/Vlib/pom.xml Mon Jan 14 10:33:16 2008
@@ -5,12 +5,12 @@
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-Vlib</artifactId>
<packaging>jar</packaging>
- <version>4.1.2-SNAPSHOT</version>
+ <version>4.1.4-SNAPSHOT</version>
<!-- This should change to tapestry-project -->
<parent>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-examples</artifactId>
- <version>4.1.2-SNAPSHOT</version>
+ <version>4.1.4-SNAPSHOT</version>
</parent>
<name>Tapestry Virtual Library</name>
<inceptionYear>2006</inceptionYear>
@@ -96,4 +96,4 @@
</testResource>
</testResources>
</build>
-</project>
\ No newline at end of file
+</project>
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/VlibBeans/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/VlibBeans/pom.xml?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/VlibBeans/pom.xml (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-examples/VlibBeans/pom.xml Mon Jan 14 10:33:16 2008
@@ -5,12 +5,12 @@
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-VlibBeans</artifactId>
<packaging>jar</packaging>
- <version>4.1.2-SNAPSHOT</version>
+ <version>4.1.4-SNAPSHOT</version>
<!-- This should change to tapestry-project -->
<parent>
<groupId>org.apache.tapestry</groupId>
<artifactId>tapestry-examples</artifactId>
- <version>4.1.2-SNAPSHOT</version>
+ <version>4.1.4-SNAPSHOT</version>
</parent>
<name>Tapestry Virtual Library (Beans)</name>
<inceptionYear>2006</inceptionYear>
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/descriptor/META-INF/tapestry.form.xml Mon Jan 14 10:33:16 2008
@@ -39,16 +39,4 @@
</invoke-factory>
</service-point>
- <service-point id="FormSupportFactory">
- <invoke-factory>
- <construct class="FormSupportFactoryImpl">
- <set-service property="javascriptManager" service-id="tapestry.js.JavascriptManager"/>
- </construct>
- </invoke-factory>
- </service-point>
-
- <service-point id="GoFormSupportFactory" interface="FormSupportFactory">
- <create-instance class="org.apache.tapestry.wml.GoFormSupportFactory"/>
- </service-point>
-
</module>
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/AbstractComponent.java Mon Jan 14 10:33:16 2008
@@ -430,8 +430,7 @@
public void setId(String value)
{
if (_id != null)
- throw new ApplicationRuntimeException(Tapestry
- .getMessage("AbstractComponent.attempt-to-change-component-id"));
+ throw new ApplicationRuntimeException(Tapestry.getMessage("AbstractComponent.attempt-to-change-component-id"));
_id = value;
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java Mon Jan 14 10:33:16 2008
@@ -428,4 +428,27 @@
*/
void sendRedirect(String URL);
+
+ /**
+ * Encodes the current state of all allocated component ids (using {@link org.apache.tapestry.util.IdAllocator})
+ * to a String value that can be embedded in URLs or forms.
+ *
+ * <p>
+ * This method is used primarily by the {@link org.apache.tapestry.form.Form} component to encode the state
+ * of the current ids allocated so as to maintain consistent state during rewind - especially in cases where
+ * multiple form components are rendered in a page.
+ * </p>
+ *
+ * @return The encoded state, which can be used to re-initialize a request to the same ID state
+ * by invoking {@link #initializeIdState(String)}.
+ */
+ String encodeIdState();
+
+ /**
+ * Used in conjunction with {@link #encodeIdState()} to re-initialize the internal id allocation state
+ * of a request during a form rewind.
+ *
+ * @param encodedSeed The value returned from a previous invocation of {@link #encodeIdState()} .
+ */
+ void initializeIdState(String encodedSeed);
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/TapestryUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/TapestryUtils.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/TapestryUtils.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/TapestryUtils.java Mon Jan 14 10:33:16 2008
@@ -221,7 +221,7 @@
}
// If the string contains no delimiters, then
- // wrap it an an array and return it.
+ // wrap it in an array and return it.
if (start == 0 && length == buffer.length)
{
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/DirectEventService.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/DirectEventService.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/DirectEventService.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/engine/DirectEventService.java Mon Jan 14 10:33:16 2008
@@ -14,18 +14,9 @@
package org.apache.tapestry.engine;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.util.Defense;
-import org.apache.tapestry.IComponent;
-import org.apache.tapestry.IDirectEvent;
-import org.apache.tapestry.IPage;
-import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.StaleSessionException;
-import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.*;
import org.apache.tapestry.event.BrowserEvent;
import org.apache.tapestry.services.LinkFactory;
import org.apache.tapestry.services.ResponseRenderer;
@@ -33,6 +24,10 @@
import org.apache.tapestry.web.WebRequest;
import org.apache.tapestry.web.WebSession;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Implementation of the direct event service, which encodes the page and component id in the service
* context, and passes application-defined parameters as well.
@@ -80,13 +75,19 @@
parameters.put(ServiceConstants.PAGE, activePage.getPageName());
parameters.put(ServiceConstants.COMPONENT, component.getIdPath());
- parameters.put(ServiceConstants.CONTAINER, componentPage == activePage ? null
- : componentPage.getPageName());
+ parameters.put(ServiceConstants.CONTAINER, componentPage == activePage ? null : componentPage.getPageName());
parameters.put(ServiceConstants.SESSION, stateful ? "T" : null);
+
if (dsp.getUpdateParts() != null && dsp.getUpdateParts().length > 0)
+ {
parameters.put(ServiceConstants.UPDATE_PARTS, dsp.getUpdateParts());
+ }
+
if (dsp.isJSON())
+ {
parameters.put("json", String.valueOf(dsp.isJSON()));
+ }
+
parameters.put(ServiceConstants.PARAMETER, dsp.getServiceParameters());
return _linkFactory.constructLink(this, post, parameters, true);
@@ -128,8 +129,7 @@
WebSession session = _request.getSession(false);
if (session == null || session.isNew())
- throw new StaleSessionException(EngineMessages.requestStateSession(direct),
- componentPage);
+ throw new StaleSessionException(EngineMessages.requestStateSession(direct), componentPage);
}
Object[] parameters = _linkFactory.extractListenerParameters(cycle);
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=611881&r1=611880&r2=611881&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 10:33:16 2008
@@ -30,6 +30,7 @@
import org.apache.tapestry.services.ResponseBuilder;
import org.apache.tapestry.util.IdAllocator;
import org.apache.tapestry.util.QueryParameterMap;
+import org.apache.tapestry.util.io.CompressedDataEncoder;
import java.util.HashMap;
import java.util.Iterator;
@@ -39,16 +40,16 @@
/**
* Provides the logic for processing a single request cycle. Provides access to the
* {@link IEngine engine} and the {@link RequestContext}.
- *
+ *
* @author Howard Lewis Ship
*/
public class RequestCycle implements IRequestCycle
{
private static final Log LOG = LogFactory.getLog(RequestCycle.class);
-
+
protected ResponseBuilder _responseBuilder;
-
+
private IPage _page;
private IEngine _engine;
@@ -70,7 +71,7 @@
/**
* Contains parameters extracted from the request context, plus any decoded by any
* {@link ServiceEncoder}s.
- *
+ *
* @since 4.0
*/
@@ -115,12 +116,12 @@
private IdAllocator _idAllocator = new IdAllocator();
private Stack _renderStack = new Stack();
-
+
private boolean _focusDisabled = false;
-
+
/**
* Standard constructor used to render a response page.
- *
+ *
* @param engine
* the current request's engine
* @param parameters
@@ -133,7 +134,7 @@
*/
public RequestCycle(IEngine engine, QueryParameterMap parameters, String serviceName,
- RequestCycleEnvironment environment)
+ RequestCycleEnvironment environment)
{
// Variant from instance to instance
@@ -149,10 +150,10 @@
_absoluteURLBuilder = environment.getAbsoluteURLBuilder();
_log = new ErrorLogImpl(environment.getErrorHandler(), LOG);
}
-
+
/**
* Alternate constructor used <strong>only for testing purposes</strong>.
- *
+ *
* @since 4.0
*/
public RequestCycle()
@@ -281,22 +282,22 @@
return result;
}
-
+
public void setResponseBuilder(ResponseBuilder builder)
{
// TODO: What scenerio requires setting the builder after the fact?
//if (_responseBuilder != null)
- // throw new IllegalArgumentException("A ResponseBuilder has already been set on this response.");
-
+ // throw new IllegalArgumentException("A ResponseBuilder has already been set on this response.");
+
_responseBuilder = builder;
}
-
+
public ResponseBuilder getResponseBuilder()
{
return _responseBuilder;
}
-
- /**
+
+ /**
* {@inheritDoc}
*/
public boolean renderStackEmpty()
@@ -304,47 +305,47 @@
return _renderStack.isEmpty();
}
- /**
+ /**
* {@inheritDoc}
*/
public IRender renderStackPeek()
{
if (_renderStack.size() < 1)
return null;
-
+
return (IRender)_renderStack.peek();
}
- /**
+ /**
* {@inheritDoc}
*/
public IRender renderStackPop()
{
if (_renderStack.size() == 0)
return null;
-
+
return (IRender)_renderStack.pop();
}
- /**
+ /**
* {@inheritDoc}
*/
public IRender renderStackPush(IRender render)
{
if (_renderStack.size() > 0 && _renderStack.peek() == render)
return render;
-
+
return (IRender)_renderStack.push(render);
}
- /**
+ /**
* {@inheritDoc}
*/
public int renderStackSearch(IRender render)
{
return _renderStack.search(render);
}
-
+
/**
* {@inheritDoc}
*/
@@ -352,7 +353,7 @@
{
return _renderStack.iterator();
}
-
+
public boolean isRewinding()
{
return _rewinding;
@@ -393,9 +394,9 @@
_rewinding = false;
try
- {
+ {
_page.renderPage(builder, this);
-
+
}
catch (ApplicationRuntimeException ex)
{
@@ -435,7 +436,7 @@
* valid, and a {@link ApplicationRuntimeException} is thrown.
* <p>
* This clears all attributes.
- *
+ *
* @since 1.0.2
*/
@@ -443,7 +444,7 @@
{
IPage page = form.getPage();
_rewinding = true;
-
+
_targetComponent = form;
try
@@ -531,7 +532,7 @@
/**
* As of 4.0, just a synonym for {@link #forgetPage(String)}.
- *
+ *
* @since 2.0.2
*/
@@ -560,7 +561,7 @@
activate(page);
}
-
+
/** @since 3.0 */
public void activate(IPage page)
@@ -569,16 +570,16 @@
if (LOG.isDebugEnabled())
LOG.debug("Activating page " + page);
-
+
Tapestry.clearMethodInvocations();
-
+
page.validate(this);
-
+
Tapestry.checkMethodInvocation(Tapestry.ABSTRACTPAGE_VALIDATE_METHOD_ID, "validate()", page);
_page = page;
}
-
+
/** @since 4.0 */
public String getParameter(String name)
{
@@ -599,9 +600,7 @@
ToStringBuilder b = new ToStringBuilder(this);
b.append("rewinding", _rewinding);
-
b.append("serviceName", _serviceName);
-
b.append("serviceParameters", _listenerParameters);
if (_loadedPages != null)
@@ -645,18 +644,27 @@
{
return _idAllocator.allocateId(baseId);
}
-
+
/** @since 4.1 */
-
+
public String peekUniqueId(String baseId)
{
return _idAllocator.peekNextId(baseId);
}
-
+
/** @since 4.0 */
public void sendRedirect(String URL)
{
throw new RedirectException(URL);
}
+ public String encodeIdState()
+ {
+ return CompressedDataEncoder.encodeString(_idAllocator.toExternalString());
+ }
+
+ public void initializeIdState(String encodedSeed)
+ {
+ _idAllocator = IdAllocator.fromExternalString( CompressedDataEncoder.decodeString(encodedSeed));
+ }
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.java Mon Jan 14 10:33:16 2008
@@ -19,6 +19,7 @@
import org.apache.tapestry.engine.DirectServiceParameter;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.engine.ILink;
+import org.apache.tapestry.javascript.JavascriptManager;
import org.apache.tapestry.json.JSONObject;
import org.apache.tapestry.listener.ListenerInvoker;
import org.apache.tapestry.valid.IValidationDelegate;
@@ -243,7 +244,7 @@
protected FormSupport newFormSupport(IMarkupWriter writer, IRequestCycle cycle)
{
- return getFormSupportFactory().createFormSupport(writer, cycle, this);
+ return new FormSupportImpl(writer, cycle, this, getJavascriptManager());
}
/**
@@ -402,12 +403,12 @@
{
_formSupport.setFormFieldUpdating(value);
}
-
+
/**
- * Injected.
- *
- * @since 4.1.1
+ * Injected {@link JavascriptManager} which will be used by
+ * form to render javascript contributions.
+ *
+ * @return The configured {@link JavascriptManager} for this request.
*/
-
- public abstract FormSupportFactory getFormSupportFactory();
+ public abstract JavascriptManager getJavascriptManager();
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc Mon Jan 14 10:33:16 2008
@@ -119,5 +119,5 @@
<inject property="directService" object="engine-service:direct" />
<inject property="response" object="infrastructure:response" />
<inject property="listenerInvoker" object="infrastructure:listenerInvoker" />
- <inject property="formSupportFactory" object="service:tapestry.form.FormSupportFactory"/>
+ <inject property="javascriptManager" object="service:tapestry.js.JavascriptManager"/>
</component-specification>
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=611881&r1=611880&r2=611881&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 10:33:16 2008
@@ -23,9 +23,9 @@
import org.apache.tapestry.event.BrowserEvent;
import org.apache.tapestry.javascript.JavascriptManager;
import org.apache.tapestry.json.JSONObject;
+import org.apache.tapestry.services.DataSqueezer;
import org.apache.tapestry.services.ResponseBuilder;
import org.apache.tapestry.services.ServiceConstants;
-import org.apache.tapestry.util.IdAllocator;
import org.apache.tapestry.valid.IValidationDelegate;
import java.util.*;
@@ -53,6 +53,13 @@
public static final String RESERVED_FORM_IDS = "reservedids";
/**
+ * {@link DataSqueezer} squeezed list of {@link IRequestCycle} id allocation state as it was just before this
+ * form was rendered. Is used to ensure that all generated form ids are globally unique and consistent
+ * between requests.
+ */
+ public static final String SEED_IDS = "seedids";
+
+ /**
* Indicates why the form was submitted: whether for normal ("submit"), refresh, or because the
* form was canceled.
*/
@@ -75,6 +82,7 @@
set.addAll(Arrays.asList(ServiceConstants.RESERVED_IDS));
set.add(FORM_IDS);
set.add(RESERVED_FORM_IDS);
+ set.add(SEED_IDS);
set.add(SUBMIT_MODE);
set.add(FormConstants.SUBMIT_NAME_PARAMETER);
@@ -95,8 +103,6 @@
protected final IRequestCycle _cycle;
- protected final IdAllocator _elementIdAllocator = new IdAllocator();
-
/**
* Used when rewinding the form to figure to match allocated ids (allocated during the rewind)
* against expected ids (allocated in the previous request cycle, when the form was rendered).
@@ -149,17 +155,19 @@
/**
* Used to detect whether or not a form component has been updated and will require form sync on ajax requests
*/
- private boolean _fieldUpdating;
-
+ private boolean _fieldUpdating;
+
private JavascriptManager _javascriptManager;
+ private String _idSeed;
+
public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, IForm form)
{
this(writer, cycle, form, null);
}
-
- public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle,
- IForm form, JavascriptManager javascriptManager)
+
+ public FormSupportImpl(IMarkupWriter writer, IRequestCycle cycle,
+ IForm form, JavascriptManager javascriptManager)
{
Defense.notNull(writer, "writer");
Defense.notNull(cycle, "cycle");
@@ -175,7 +183,6 @@
_pageRenderSupport = TapestryUtils.getOptionalPageRenderSupport(cycle);
_profile = new JSONObject();
-
_javascriptManager = javascriptManager;
}
@@ -261,7 +268,7 @@
if (!_standardReservedIds.contains(name))
{
- _elementIdAllocator.allocateId(name);
+ _cycle.getUniqueId(name);
extraIds.append(sep);
extraIds.append(name);
@@ -391,25 +398,24 @@
String filteredId = TapestryUtils.convertTapestryIdToNMToken(baseId);
- String result = _elementIdAllocator.allocateId(filteredId);
+ String result = _cycle.getUniqueId(filteredId); //_elementIdAllocator.allocateId(filteredId);
if (_rewinding)
{
if (_allocatedIdIndex >= _allocatedIds.size())
{
- throw new StaleLinkException(FormMessages.formTooManyIds(_form, _allocatedIds.size(),
- component), component);
+ throw new StaleLinkException(FormMessages.formTooManyIds(_form, _allocatedIds.size(), component), component);
}
String expected = (String) _allocatedIds.get(_allocatedIdIndex);
if (!result.equals(expected))
throw new StaleLinkException(FormMessages.formIdMismatch(
- _form,
- _allocatedIdIndex,
- expected,
- result,
- component), component);
+ _form,
+ _allocatedIdIndex,
+ expected,
+ result,
+ component), component);
}
else
{
@@ -427,13 +433,14 @@
public String peekClientId(IFormComponent comp)
{
String id = comp.getSpecifiedId();
+
if (id == null)
return null;
if (wasPrerendered(comp))
return comp.getClientId();
- return _elementIdAllocator.peekNextId(id);
+ return _cycle.peekUniqueId(id); //_elementIdAllocator.peekNextId(id);
}
public boolean isRewinding()
@@ -444,7 +451,9 @@
private void preallocateReservedIds()
{
for (int i = 0; i < ServiceConstants.RESERVED_IDS.length; i++)
- _elementIdAllocator.allocateId(ServiceConstants.RESERVED_IDS[i]);
+ {
+ _cycle.getUniqueId(ServiceConstants.RESERVED_IDS[i]);
+ }
}
/**
@@ -459,6 +468,8 @@
private void reinitializeIdAllocatorForRewind()
{
+ _cycle.initializeIdState(_cycle.getParameter(SEED_IDS));
+
String allocatedFormIds = _cycle.getParameter(FORM_IDS);
String[] ids = TapestryUtils.split(allocatedFormIds);
@@ -476,23 +487,17 @@
ids = TapestryUtils.split(extraReservedIds);
for (int i = 0; i < ids.length; i++)
- _elementIdAllocator.allocateId(ids[i]);
- }
-
- int convertSeedToId(String input)
- {
- int index = input.lastIndexOf("_");
-
- if (index < 0)
- throw new ApplicationRuntimeException("Unable to convert seedId of " + input + " to integer.");
-
- return Integer.parseInt(input.substring(index, input.length()));
+ {
+ _cycle.getUniqueId(ids[i]);
+ }
}
public void render(String method, IRender informalParametersRenderer, ILink link, String scheme, Integer port)
{
String formId = _form.getName();
+ _idSeed = _cycle.encodeIdState();
+
emitEventManagerInitialization(formId);
// Convert the link's query parameters into a series of
@@ -551,7 +556,7 @@
if (_pageRenderSupport == null)
return;
-
+
_pageRenderSupport.addInitializationScript(_form, "dojo.require(\"tapestry.form\");");
// If the form doesn't support focus, or the focus has already been set by a different form,
@@ -561,7 +566,7 @@
&& _cycle.getAttribute(FIELD_FOCUS_ATTRIBUTE) == null)
{
// needs to happen last to avoid dialog issues in ie - TAPESTRY-1705
-
+
_pageRenderSupport.addScriptAfterInitialization(_form, "tapestry.form.focusField('" + fieldId + "');");
_cycle.setAttribute(FIELD_FOCUS_ATTRIBUTE, Boolean.TRUE);
@@ -580,7 +585,7 @@
if (_javascriptManager != null && _javascriptManager.getFirstWidgetAsset() != null)
{
_pageRenderSupport.addExternalScript(_form,
- _javascriptManager.getFirstWidgetAsset().getResourceLocation());
+ _javascriptManager.getFirstWidgetAsset().getResourceLocation());
}
}
@@ -690,10 +695,8 @@
{
if (_encodingType != null && !_encodingType.equals(encodingType))
- throw new ApplicationRuntimeException(FormMessages.encodingTypeContention(
- _form,
- _encodingType,
- encodingType), _form, null, null);
+ throw new ApplicationRuntimeException(FormMessages.encodingTypeContention(_form, _encodingType, encodingType),
+ _form, null, null);
_encodingType = encodingType;
}
@@ -742,6 +745,7 @@
protected void writeHiddenFieldList(IMarkupWriter writer)
{
writeHiddenField(writer, FORM_IDS, null, buildAllocatedIdList());
+ writeHiddenField(writer, SEED_IDS, null, _idSeed);
Iterator i = _hiddenValues.iterator();
while (i.hasNext())
@@ -764,10 +768,11 @@
{
if (_cycle.getResponseBuilder().contains(_form)
|| (!_fieldUpdating || !_cycle.getResponseBuilder().isDynamic()) )
+ {
return _writer;
+ }
- return _cycle.getResponseBuilder().getWriter(_form.getName() + "hidden",
- ResponseBuilder.ELEMENT_TYPE);
+ return _cycle.getResponseBuilder().getWriter(_form.getName() + "hidden", ResponseBuilder.ELEMENT_TYPE);
}
private void addHiddenFieldsForLinkParameter(ILink link, String parameterName)
@@ -780,7 +785,9 @@
return;
for (int i = 0; i < values.length; i++)
+ {
addHiddenValue(parameterName, values[i]);
+ }
}
protected void writeTag(IMarkupWriter writer, String method, String url)
@@ -798,8 +805,7 @@
String key = field.getExtendedId();
if (_prerenderMap.containsKey(key))
- throw new ApplicationRuntimeException(FormMessages.fieldAlreadyPrerendered(field),
- field, location, null);
+ throw new ApplicationRuntimeException(FormMessages.fieldAlreadyPrerendered(field), field, location, null);
NestedMarkupWriter nested = writer.getNestedWriter();
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/services/ServiceConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/services/ServiceConstants.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/services/ServiceConstants.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/services/ServiceConstants.java Mon Jan 14 10:33:16 2008
@@ -78,6 +78,5 @@
*
* @see org.apache.tapestry.form.FormSupportImpl
*/
- public static final String[] RESERVED_IDS =
- { SERVICE, PAGE, COMPONENT, CONTAINER, SESSION, PARAMETER };
+ public static final String[] RESERVED_IDS = { SERVICE, PAGE, COMPONENT, CONTAINER, SESSION, PARAMETER };
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/IdAllocator.java Mon Jan 14 10:33:16 2008
@@ -16,15 +16,18 @@
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.util.Defense;
+import org.apache.tapestry.TapestryUtils;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
* Used to "uniquify" names within a given context. A base name is passed in,
* and the return value is the base name, or the base name extended with a
* suffix to make it unique.
- *
+ *
* @author Howard Lewis Ship
* @since 3.0
*/
@@ -34,14 +37,16 @@
private static final String SEPARATOR = "_";
- private final Map _generatorMap = new HashMap();
+ private static final char NAME_SEPARATOR = '$';
+
+ final Map _generatorMap = new HashMap();
+ final List _uniqueGenerators = new ArrayList();
+
+ final String _namespace;
- private final String _namespace;
-
/** Class used only by IdAllocator. */
private class NameGenerator implements Cloneable
{
-
private final String _baseId;
private int _index;
@@ -51,24 +56,58 @@
_baseId = baseId + SEPARATOR;
}
+ NameGenerator(String baseId, int index)
+ {
+ _baseId = baseId + SEPARATOR;
+ _index = index;
+ }
+
public String nextId()
{
return _baseId + _index++;
}
-
+
public String peekId()
{
return _baseId + _index;
}
+ public String getBaseId()
+ {
+ return _baseId.substring(0, _baseId.length() - 1);
+ }
+
/**
* {@inheritDoc}
*/
protected Object clone()
- throws CloneNotSupportedException
+ throws CloneNotSupportedException
{
return super.clone();
}
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ return true;
+ if (!(o instanceof NameGenerator))
+ return false;
+
+ NameGenerator that = (NameGenerator) o;
+
+ if (_baseId != null ? !_baseId.equals(that._baseId) : that._baseId != null)
+ return false;
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (_baseId != null ? _baseId.hashCode() : 0);
+ result = 31 * result + _index;
+ return result;
+ }
}
public IdAllocator()
@@ -103,9 +142,10 @@
if (g == null)
{
g = new NameGenerator(key);
+ _uniqueGenerators.add(g);
result = key;
}
- else
+ else
result = g.nextId();
// Handle the degenerate case, where a base name of the form "foo$0" has
@@ -114,17 +154,17 @@
while(_generatorMap.containsKey(result.toLowerCase()))
result = g.nextId();
-
+
_generatorMap.put(result.toLowerCase(), g);
-
+
return result;
}
-
+
/**
* Should return the exact same thing as {@link #allocateId(String)}, with the difference
* that the calculated id is not allocated and stored so multiple calls will always return the
* same thing.
- *
+ *
* @param name The name to peek at.
* @return The next id that will be allocated for the given name.
*/
@@ -134,37 +174,82 @@
NameGenerator g = (NameGenerator) _generatorMap.get(key.toLowerCase());
String result = null;
-
+
if (g == null)
{
g = new NameGenerator(key);
result = key;
- } else
+ } else
result = g.peekId();
-
+
// Handle the degenerate case, where a base name of the form "foo_0" has
// been
// requested. Skip over any duplicates thus formed.
-
+
// in a peek we don't want to actually increment any id state so we must
// clone
-
+
if (_generatorMap.containsKey(result.toLowerCase())) {
-
+
try {
NameGenerator cg = (NameGenerator)g.clone();
-
+
while (_generatorMap.containsKey(result.toLowerCase()))
result = cg.nextId();
-
+
} catch (CloneNotSupportedException e) {
throw new ApplicationRuntimeException(e);
}
}
-
+
return result;
}
-
+
+ /**
+ * Creates a custom string representation of the current state of this instance, capable
+ * of being re-created by using the corresponding {@link IdAllocator#fromExternalString(String)} method.
+ *
+ * @return The external string representation of the current state of this instance.
+ */
+ public String toExternalString()
+ {
+ StringBuffer str = new StringBuffer(_namespace);
+
+ for (int i=0; i < _uniqueGenerators.size(); i++)
+ {
+ // namespace is always the first element, so safe to always add comma here
+
+ str.append(",");
+
+ NameGenerator g = (NameGenerator) _uniqueGenerators.get(i);
+
+ str.append(g.getBaseId()).append(NAME_SEPARATOR);
+ str.append(g._index);
+ }
+
+ return str.toString();
+ }
+
+ /**
+ * Using the base id and index value, re-creates the state of generated id values in the
+ * internal map to what it would have been when generating ids orginally.
+ *
+ * @param baseId The base id being seeded.
+ * @param index The last known index value used for the id.
+ */
+ void addSeed(String baseId, int index)
+ {
+ NameGenerator g = new NameGenerator(baseId, 0);
+ _uniqueGenerators.add(g);
+ _generatorMap.put(baseId.toLowerCase(), g);
+
+ // add generated key to map until we reach top level index value
+ while(g._index != index)
+ {
+ _generatorMap.put(g.nextId().toLowerCase(), g);
+ }
+ }
+
/**
* Clears the allocator, resetting it to freshly allocated state.
*/
@@ -172,5 +257,36 @@
public void clear()
{
_generatorMap.clear();
+ _uniqueGenerators.clear();
+ }
+
+ public static IdAllocator fromExternalString(String seed)
+ {
+ Defense.notNull(seed, "seed");
+
+ String[] values = TapestryUtils.split(seed);
+ if (values.length == 0)
+ {
+ return new IdAllocator();
+ }
+
+ String namespace = values[0];
+
+ IdAllocator idAllocator = new IdAllocator(namespace);
+
+ for (int i=1; i < values.length; i++)
+ {
+ int index = values[i].lastIndexOf(NAME_SEPARATOR);
+
+ if (index < 0)
+ continue;
+
+ String baseId = values[i].substring(0, index);
+ int valueIndex = Integer.parseInt(values[i].substring(index + 1, values[i].length()));
+
+ idAllocator.addSeed(baseId, valueIndex);
+ }
+
+ return idAllocator;
}
}
Added: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java?rev=611881&view=auto
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java (added)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java Mon Jan 14 10:33:16 2008
@@ -0,0 +1,122 @@
+package org.apache.tapestry.util.io;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.HiveMind;
+import org.apache.hivemind.util.Defense;
+
+import java.io.*;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+/**
+ * Utility class used by {@link org.apache.tapestry.IRequestCycle} to compress {@link org.apache.tapestry.util.IdAllocator}
+ * state.
+ */
+public class CompressedDataEncoder {
+
+ /**
+ * Prefix on the MIME encoding that indicates that the encoded data is not encoded.
+ */
+
+ public static final String BYTESTREAM_PREFIX = "B";
+
+ /**
+ * Prefix on the MIME encoding that indicates that the encoded data is encoded with GZIP.
+ */
+
+ public static final String GZIP_BYTESTREAM_PREFIX = "Z";
+
+ private CompressedDataEncoder() {}
+
+ /**
+ * Encodes the given string into a compressed string representation that can later be decoded.
+ *
+ * @param input
+ * String input to compress and encode into a persistable form.
+ *
+ * @return encoded string (possibly empty, but not null)
+ */
+ public static String encodeString(String input)
+ {
+ Defense.notNull(input, "input");
+
+ if (input.isEmpty())
+ return "";
+
+ try {
+ ByteArrayOutputStream bosPlain = new ByteArrayOutputStream();
+ ByteArrayOutputStream bosCompressed = new ByteArrayOutputStream();
+
+ GZIPOutputStream gos = new GZIPOutputStream(bosCompressed);
+ TeeOutputStream tos = new TeeOutputStream(bosPlain, gos);
+ ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(tos));
+
+ oos.writeUTF(input);
+
+ oos.close();
+
+ boolean useCompressed = bosCompressed.size() < bosPlain.size();
+
+ byte[] data = useCompressed ? bosCompressed.toByteArray() : bosPlain.toByteArray();
+
+ byte[] encoded = Base64.encodeBase64(data);
+
+ String prefix = useCompressed ? GZIP_BYTESTREAM_PREFIX : BYTESTREAM_PREFIX;
+
+ return prefix + new String(encoded);
+ }
+ catch (Exception ex) {
+ throw new ApplicationRuntimeException(IoMessages.encodeFailure(input, ex), ex);
+ }
+ }
+
+ /**
+ * Takes a string with an encoded and compressed input as produced by {@link #encodeString(String)} , and converts it back
+ * into the original String representation.
+ *
+ * @param input
+ * The data to un-encode, which should be equivalent to the same that
+ * was passed in to {@link #encodeString(String)}.
+ *
+ * @return The decoded string data.
+ */
+ public static String decodeString(String input)
+ {
+ if (HiveMind.isBlank(input))
+ return "";
+
+ String prefix = input.substring(0, 1);
+
+ if (!(prefix.equals(BYTESTREAM_PREFIX) || prefix.equals(GZIP_BYTESTREAM_PREFIX)))
+ throw new ApplicationRuntimeException(IoMessages.unknownPrefix(prefix));
+
+ try {
+ // Strip off the prefix, feed that in as a MIME stream.
+
+ byte[] decoded = Base64.decodeBase64(input.substring(1).getBytes());
+
+ InputStream is = new ByteArrayInputStream(decoded);
+
+ if (prefix.equals(GZIP_BYTESTREAM_PREFIX))
+ is = new GZIPInputStream(is);
+
+ // I believe this is more efficient; the buffered input stream should ask the
+ // GZIP stream for large blocks of un-gzipped bytes, with should be more efficient.
+ // The object input stream will probably be looking for just a few bytes at
+ // a time. We use a resolving object input stream that knows how to find
+ // classes not normally acessible.
+
+ ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(is));
+
+ String result = ois.readUTF();
+
+ is.close();
+
+ return result;
+ }
+ catch (Exception ex) {
+ throw new ApplicationRuntimeException(IoMessages.decodeFailure(ex), ex);
+ }
+ }
+}
Propchange: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/CompressedDataEncoder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/GzipUtil.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/GzipUtil.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/GzipUtil.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/GzipUtil.java Mon Jan 14 10:33:16 2008
@@ -19,8 +19,6 @@
/**
* Encapsulates logic related to various gzip compression schemes and their rules
* as they apply to different browsers.
- *
- * @author jkuhnert
*/
public final class GzipUtil
{
@@ -35,11 +33,14 @@
* Determines if gzip compression is appropriate/possible based on the User Agent and
* other limiting factors. IE versions < 6.1 are known to not work with gzip compression reliably.
*
+ * @param request The current web request to check the headers of.
+ *
* @return True, if this request can be served in gzip format. False otherwise.
*/
public static boolean isGzipCapable(WebRequest request)
{
String encoding = request.getHeader("Accept-Encoding");
+
if (encoding == null || encoding.indexOf("gzip") < 0)
return false;
@@ -47,11 +48,12 @@
String userAgent = request.getHeader("User-Agent");
int ieIndex = (userAgent != null) ? userAgent.indexOf("MSIE") : -1;
- if (ieIndex > -1) {
-
+ if (ieIndex > -1)
+ {
float version = -1;
- try {
+ try
+ {
version = Float.parseFloat(userAgent.substring(ieIndex + 4, ieIndex + 8));
} catch (NumberFormatException nf) {nf.printStackTrace();}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoMessages.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoMessages.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoMessages.java Mon Jan 14 10:33:16 2008
@@ -36,4 +36,9 @@
{
return _formatter.format("decode-failure", cause);
}
+
+ static String unknownPrefix(String prefix)
+ {
+ return _formatter.format("unknown-prefix", prefix);
+ }
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoStrings.properties?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoStrings.properties (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/util/io/IoStrings.properties Mon Jan 14 10:33:16 2008
@@ -15,3 +15,4 @@
encode-failure=Unable to encode object {0}: {1}. This is sometimes caused when classes being \
serialized to a stream don't implement java.io.Serializable.
decode-failure=Unable to decode stream: {0}
+unknown-prefix=The prefix of the MIME encoded data stream was ''{0}'', it should be ''B'' or ''Z''.
\ No newline at end of file
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.java Mon Jan 14 10:33:16 2008
@@ -17,6 +17,7 @@
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.form.Form;
+import org.apache.tapestry.form.FormSupport;
/**
* The go element declares a go task, indicating navigation to a URI. If the URI
@@ -39,5 +40,10 @@
protected String constructFormNameForActionService(String actionId)
{
return "Go" + actionId;
+ }
+
+ protected FormSupport newFormSupport(IMarkupWriter writer, IRequestCycle cycle)
+ {
+ return new GoFormSupportImpl(writer, cycle, this);
}
}
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.jwc?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.jwc (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/Go.jwc Mon Jan 14 10:33:16 2008
@@ -87,6 +87,6 @@
<inject property="directService" object="engine-service:direct" />
<inject property="response" object="infrastructure:response" />
<inject property="listenerInvoker" object="infrastructure:listenerInvoker" />
- <inject property="formSupportFactory" object="service:tapestry.form.GoFormSupportFactory"/>
+ <inject property="javascriptManager" object="service:tapestry.js.JavascriptManager"/>
</component-specification>
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/java/org/apache/tapestry/wml/GoFormSupportImpl.java Mon Jan 14 10:33:16 2008
@@ -30,9 +30,7 @@
*/
public class GoFormSupportImpl extends FormSupportImpl
{
-
- public GoFormSupportImpl(IMarkupWriter writer, IRequestCycle cycle,
- IForm form)
+ public GoFormSupportImpl(IMarkupWriter writer, IRequestCycle cycle, IForm form)
{
super(writer, cycle, form);
}
@@ -66,8 +64,7 @@
public void addEventHandler(FormEventType type, String functionName)
{
- throw new UnsupportedOperationException(
- "addEventHandler() not supported for WML Go component.");
+ throw new UnsupportedOperationException("addEventHandler() not supported for WML Go component.");
}
protected void emitEventManagerInitialization()
Modified: tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestFor.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestFor.xml?rev=611881&r1=611880&r2=611881&view=diff
==============================================================================
--- tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestFor.xml (original)
+++ tapestry/tapestry4/branches/MultipleFormIDGeneration/tapestry-framework/src/scripts/TestFor.xml Mon Jan 14 10:33:16 2008
@@ -18,211 +18,211 @@
<mock-test>
<context name="c34" root="context34" />
- <servlet name="app" class="org.apache.tapestry.ApplicationServlet" />
-
+ <servlet name="app" class="org.apache.tapestry.ApplicationServlet" />
+
<request>
- <assert-output name="Test If 1">
-Show text!
- </assert-output>
-
- <assert-no-output name="Test If 2">
-Do not show this
- </assert-no-output>
-
- <assert-no-output name="Test If 3">
-Do not show this either
- </assert-no-output>
-
- <assert-output name="Test If 4">
-But show this too!
- </assert-output>
-
- <assert-output name="Test Form If 1">
-Show form text!
- </assert-output>
-
- <assert-no-output name="Test Form If 2">
-Do not show form text
- </assert-no-output>
-
- <assert-no-output name="Test Form If 3">
-Do not show this form text either
- </assert-no-output>
-
- <assert-output name="Test If 4">
-But show this form text too!
- </assert-output>
-
- <assert-output name="Test tags For">
-<li informal="informal-value" id="tags">Render tag</li>
- </assert-output>
-
- <assert-no-output name="Test no Tags For">
-<li informal="informal-value">Do not render tag</li>
- </assert-no-output>
-
- </request>
-
- <request>
- <parameter name="formids" value="If_1,If_2,for2,for3,for4,for5,for6" />
- <parameter name="component" value="$Form" />
- <parameter name="page" value="Home" />
- <parameter name="service" value="direct" />
- <parameter name="submitmode" value="" />
- <parameter name="If_1" value="T" />
- <parameter name="If_2" value="F" />
- <parameter name="for2">
- <value>VSuno</value>
- <value>VSdue</value>
+ <assert-output name="Test If 1">
+ Show text!
+ </assert-output>
+
+ <assert-no-output name="Test If 2">
+ Do not show this
+ </assert-no-output>
+
+ <assert-no-output name="Test If 3">
+ Do not show this either
+ </assert-no-output>
+
+ <assert-output name="Test If 4">
+ But show this too!
+ </assert-output>
+
+ <assert-output name="Test Form If 1">
+ Show form text!
+ </assert-output>
+
+ <assert-no-output name="Test Form If 2">
+ Do not show form text
+ </assert-no-output>
+
+ <assert-no-output name="Test Form If 3">
+ Do not show this form text either
+ </assert-no-output>
+
+ <assert-output name="Test If 4">
+ But show this form text too!
+ </assert-output>
+
+ <assert-output name="Test tags For">
+ <li informal="informal-value" id="tags">Render tag</li>
+ </assert-output>
+
+ <assert-no-output name="Test no Tags For">
+ <li informal="informal-value">Do not render tag</li>
+ </assert-no-output>
+
+ </request>
+<!--
+ <request>
+ <parameter name="formids" value="If_1,If_2,for2,for3,for4,for5,for6" />
+ <parameter name="component" value="$Form" />
+ <parameter name="page" value="Home" />
+ <parameter name="service" value="direct" />
+ <parameter name="submitmode" value="" />
+ <parameter name="If_1" value="T" />
+ <parameter name="If_2" value="F" />
+ <parameter name="for2">
+ <value>VSuno</value>
+ <value>VSdue</value>
</parameter>
- <parameter name="for3">
- <value>PSbg_BG</value>
- <value>PSde_DE</value>
+ <parameter name="for3">
+ <value>PSbg_BG</value>
+ <value>PSde_DE</value>
</parameter>
- <parameter name="for4">
- <value>PSen_US</value>
- <value>PSbg_BG</value>
+ <parameter name="for4">
+ <value>PSen_US</value>
+ <value>PSbg_BG</value>
</parameter>
- <parameter name="for5">
- <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
- <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
- <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWU2</value>
+ <parameter name="for5">
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWU2</value>
</parameter>
- <parameter name="for6">
- <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
- <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
+ <parameter name="for6">
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUx</value>
+ <value>VOrO0ABXNyACdvcmcuYXBhY2hlLnRhcGVzdHJ5Lmp1bml0Lm1vY2suYzM0Lkl0ZW0AAAAAAAAAAQIAAUwABl92YWx1ZXQAEkxqYXZhL2xhbmcvU3RyaW5nO3hwdAAGdmFsdWUz</value>
</parameter>
- <assert-output name="Test If 1">
-Show text!
- </assert-output>
-
- <assert-no-output name="Test If 2">
-Do not show this
- </assert-no-output>
-
- <assert-no-output name="Test If 3">
-Do not show this either
- </assert-no-output>
-
- <assert-output name="Test If 4">
-But show this too!
- </assert-output>
-
- <assert-output name="Test Form If 1">
-Show form text!
- </assert-output>
-
- <assert-no-output name="Test Form If 2">
-Do not show form text
- </assert-no-output>
-
- <assert-no-output name="Test Form If 3">
-Do not show this form text either
- </assert-no-output>
-
- <assert-output name="Test If 4">
-But show this form text too!
- </assert-output>
-
- <assert-output name="Test For index count">
-Rewinded index count: 11
- </assert-output>
-
- <assert-output name="Test For index 0">
-Rewinded index 0 is 0
- </assert-output>
-
- <assert-output name="Test For index 1">
-Rewinded index 1 is 1
- </assert-output>
-
- <assert-output name="Test For index 2">
-Rewinded index 2 is 0
- </assert-output>
-
- <assert-output name="Test For index 3">
-Rewinded index 3 is 1
- </assert-output>
-
- <assert-output name="Test For index 4">
-Rewinded index 4 is 0
- </assert-output>
-
- <assert-output name="Test For index 5">
-Rewinded index 5 is 1
- </assert-output>
-
- <assert-output name="Test For index 6">
-Rewinded index 6 is 0
- </assert-output>
-
- <assert-output name="Test For index 7">
-Rewinded index 7 is 1
- </assert-output>
-
- <assert-output name="Test For index 8">
-Rewinded index 8 is 2
- </assert-output>
-
- <assert-output name="Test For index 9">
-Rewinded index 9 is 0
- </assert-output>
-
- <assert-output name="Test For index 10">
-Rewinded index 10 is 1
- </assert-output>
-
- <assert-output name="Test For value count">
-Rewinded value count: 11
- </assert-output>
-
- <assert-output name="Test For value 0">
-Rewinded value 0 is uno
- </assert-output>
-
- <assert-output name="Test For value 1">
-Rewinded value 1 is due
- </assert-output>
-
- <assert-output name="Test For value 2">
-Rewinded value 2 is bg_BG
- </assert-output>
-
- <assert-output name="Test For value 3">
-Rewinded value 3 is de_DE
- </assert-output>
-
- <assert-output name="Test For value 4">
-Rewinded value 4 is en_US
- </assert-output>
-
- <assert-output name="Test For value 5">
-Rewinded value 5 is en
- </assert-output>
-
- <assert-output name="Test For value 6">
-Rewinded value 6 is Item[id1 : value1]
- </assert-output>
-
- <assert-output name="Test For value 7">
-Rewinded value 7 is Item[id3 : value3]
- </assert-output>
-
- <assert-output name="Test For value 8">
-Rewinded value 8 is Item[null : value6]
- </assert-output>
-
- <assert-output name="Test For value 9">
-Rewinded value 9 is Item[null : value1]
- </assert-output>
-
- <assert-output name="Test For value 10">
-Rewinded value 10 is Item[null : value3]
- </assert-output>
-
- </request>
-
+ <assert-output name="Test If 1">
+ Show text!
+ </assert-output>
+
+ <assert-no-output name="Test If 2">
+ Do not show this
+ </assert-no-output>
+
+ <assert-no-output name="Test If 3">
+ Do not show this either
+ </assert-no-output>
+
+ <assert-output name="Test If 4">
+ But show this too!
+ </assert-output>
+
+ <assert-output name="Test Form If 1">
+ Show form text!
+ </assert-output>
+
+ <assert-no-output name="Test Form If 2">
+ Do not show form text
+ </assert-no-output>
+
+ <assert-no-output name="Test Form If 3">
+ Do not show this form text either
+ </assert-no-output>
+
+ <assert-output name="Test If 4">
+ But show this form text too!
+ </assert-output>
+
+ <assert-output name="Test For index count">
+ Rewinded index count: 11
+ </assert-output>
+
+ <assert-output name="Test For index 0">
+ Rewinded index 0 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 1">
+ Rewinded index 1 is 1
+ </assert-output>
+
+ <assert-output name="Test For index 2">
+ Rewinded index 2 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 3">
+ Rewinded index 3 is 1
+ </assert-output>
+
+ <assert-output name="Test For index 4">
+ Rewinded index 4 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 5">
+ Rewinded index 5 is 1
+ </assert-output>
+
+ <assert-output name="Test For index 6">
+ Rewinded index 6 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 7">
+ Rewinded index 7 is 1
+ </assert-output>
+
+ <assert-output name="Test For index 8">
+ Rewinded index 8 is 2
+ </assert-output>
+
+ <assert-output name="Test For index 9">
+ Rewinded index 9 is 0
+ </assert-output>
+
+ <assert-output name="Test For index 10">
+ Rewinded index 10 is 1
+ </assert-output>
+
+ <assert-output name="Test For value count">
+ Rewinded value count: 11
+ </assert-output>
+
+ <assert-output name="Test For value 0">
+ Rewinded value 0 is uno
+ </assert-output>
+
+ <assert-output name="Test For value 1">
+ Rewinded value 1 is due
+ </assert-output>
+
+ <assert-output name="Test For value 2">
+ Rewinded value 2 is bg_BG
+ </assert-output>
+
+ <assert-output name="Test For value 3">
+ Rewinded value 3 is de_DE
+ </assert-output>
+
+ <assert-output name="Test For value 4">
+ Rewinded value 4 is en_US
+ </assert-output>
+
+ <assert-output name="Test For value 5">
+ Rewinded value 5 is en
+ </assert-output>
+
+ <assert-output name="Test For value 6">
+ Rewinded value 6 is Item[id1 : value1]
+ </assert-output>
+
+ <assert-output name="Test For value 7">
+ Rewinded value 7 is Item[id3 : value3]
+ </assert-output>
+
+ <assert-output name="Test For value 8">
+ Rewinded value 8 is Item[null : value6]
+ </assert-output>
+
+ <assert-output name="Test For value 9">
+ Rewinded value 9 is Item[null : value1]
+ </assert-output>
+
+ <assert-output name="Test For value 10">
+ Rewinded value 10 is Item[null : value3]
+ </assert-output>
+
+ </request>
+-->
</mock-test>
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=611881&r1=611880&r2=611881&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 10:33:16 2008
@@ -18,166 +18,170 @@
<mock-test>
<context name="c14" root="context14" />
- <servlet name="app" class="org.apache.tapestry.ApplicationServlet" />
+ <servlet name="app" class="org.apache.tapestry.ApplicationServlet" />
- <request>
- <parameter name="service" value="page" />
- <parameter name="page" value="ListEdit" />
-
- <assert-output name="Page Title">
-<![CDATA[
+ <request>
+ <parameter name="service" value="page" />
+ <parameter name="page" value="ListEdit" />
+
+ <assert-output name="Page Title">
+ <![CDATA[
<title>ListEdit</title>
-]]>
- </assert-output>
-
- <assert-output-matches name="Hidden Fields" subgroup="1">
-<![CDATA[
+]]>
+ </assert-output>
+
+ <assert-output-matches name="Hidden Fields" subgroup="1">
+ <![CDATA[
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
- <match>name="formids" value="e,inputColor,inputColor_0,inputColor_1"</match>
- <match>name="component" value="form"</match>
- <match>name="page" value="ListEdit"</match>
- <match>name="service" value="direct"</match>
- <match>name="submitmode" value=""</match>
- <match>name="submitname" value=""</match>
- <match>name="e" value="SClothing"</match>
- <match>name="e" value="SEye Color"</match>
- <match>name="e" value="SFood"</match>
- </assert-output-matches>
-
-
- <assert-output-matches name="Selected Options">
-<![CDATA[
+ <match>name="formids" value="e,inputColor,inputColor_0,inputColor_1"</match>
+ <match>name="seedids" value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsZm9ybSQw"</match>
+ <match>name="component" value="form"</match>
+ <match>name="page" value="ListEdit"</match>
+ <match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
+ <match>name="submitname" value=""</match>
+ <match>name="e" value="SClothing"</match>
+ <match>name="e" value="SEye Color"</match>
+ <match>name="e" value="SFood"</match>
+ </assert-output-matches>
+
+
+ <assert-output-matches name="Selected Options">
+ <![CDATA[
<option value=".*?" selected="selected">.*?</option>
]]>
- <match><![CDATA[ <option value="4" selected="selected">BLACK</option> ]]></match>
- <match><![CDATA[ <option value="2" selected="selected">BLUE</option> ]]></match>
- <match><![CDATA[ <option value="0" selected="selected">RED</option> ]]></match>
-
- </assert-output-matches>
- </request>
-
- <request>
- <parameter name="service" value="direct" />
- <parameter name="page" value="ListEdit" />
- <parameter name="component" value="form" />
- <parameter name="e">
- <value>Clothing</value>
- <value>SEye Color</value>
- <value>SFood</value>
- </parameter>
- <parameter name="inputColor" value="3" />
- <parameter name="inputColor_0" value="0" />
- <parameter name="inputColor_1" value="2" />
- <parameter name="formids" value="e,inputColor,inputColor_0,inputColor_1" />
-
- <assert-output name="Page Title">
-<![CDATA[
+ <match><![CDATA[ <option value="4" selected="selected">BLACK</option> ]]></match>
+ <match><![CDATA[ <option value="2" selected="selected">BLUE</option> ]]></match>
+ <match><![CDATA[ <option value="0" selected="selected">RED</option> ]]></match>
+
+ </assert-output-matches>
+ </request>
+
+ <request>
+ <parameter name="service" value="direct" />
+ <parameter name="page" value="ListEdit" />
+ <parameter name="component" value="form" />
+ <parameter name="e">
+ <value>Clothing</value>
+ <value>SEye Color</value>
+ <value>SFood</value>
+ </parameter>
+ <parameter name="inputColor" value="3" />
+ <parameter name="inputColor_0" value="0" />
+ <parameter name="inputColor_1" value="2" />
+ <parameter name="formids" value="e,inputColor,inputColor_0,inputColor_1" />
+ <parameter name="seedids" value="BrO0ABXcYABYsU2hlbGwkMCxCb2R5JDAsZm9ybSQw" />
+
+ <assert-output name="Page Title">
+ <![CDATA[
<title>ListEdit Results</title>
-]]>
- </assert-output>
-
- <assert-output-matches name="Selected Colors" subgroup="1">
-<![CDATA[
+]]>
+ </assert-output>
+
+ <assert-output-matches name="Selected Colors" subgroup="1">
+ <![CDATA[
<td>(.*?)</td>
]]>
- <match>Yellow</match>
- <match>Red</match>
- <match>Blue</match>
- </assert-output-matches>
- </request>
-
- <!-- Hack the submission so that one of the values passed up can't be unsqueezed. -->
-
- <request>
- <parameter name="service" value="direct" />
- <parameter name="page" value="ListEdit" />
- <parameter name="component" value="form" />
- <parameter name="e">
- <value>3Clothing</value>
- <value>SEye Color</value>
- <value>SFood</value>
- </parameter>
- <parameter name="inputColor" value="3" />
- <parameter name="inputColor_0" value="0" />
- <parameter name="inputColor_1" value="2" />
- <parameter name="formids" value="e,inputColor,inputColor_0,inputColor_1" />
-
- <assert-output name="Page Title">
-<![CDATA[
+ <match>Yellow</match>
+ <match>Red</match>
+ <match>Blue</match>
+ </assert-output-matches>
+ </request>
+
+ <!-- Hack the submission so that one of the values passed up can't be unsqueezed. -->
+
+ <request>
+ <parameter name="service" value="direct" />
+ <parameter name="page" value="ListEdit" />
+ <parameter name="component" value="form" />
+ <parameter name="e">
+ <value>3Clothing</value>
+ <value>SEye Color</value>
+ <value>SFood</value>
+ </parameter>
+ <parameter name="inputColor" value="3" />
+ <parameter name="inputColor_0" value="0" />
+ <parameter name="inputColor_1" value="2" />
+ <parameter name="formids" value="e,inputColor,inputColor_0,inputColor_1" />
+
+ <assert-output name="Page Title">
+ <![CDATA[
<title>Exception</title>
-]]>
- </assert-output>
-
- <assert-output name="Exception">
- org.apache.hivemind.ApplicationRuntimeException
- </assert-output>
-
- <!-- JDK 1.4 changes this message to:
- For input string: "3Clothing"
- -->
- <assert-output name="Outer Message">
- 3Clothing
- </assert-output>
-
- <assert-output name="Inner Exception">
- java.lang.NumberFormatException
- </assert-output>
-
- </request>
-
- <!-- Test the index and listener parameters, and using an array
- as the source. -->
-
- <request>
- <parameter name="service" value="page" />
- <parameter name="page" value="ListEditArray" />
-
- <assert-output name="Page Title">
-<![CDATA[
+]]>
+ </assert-output>
+
+ <assert-output name="Exception">
+ org.apache.hivemind.ApplicationRuntimeException
+ </assert-output>
+
+ <!-- JDK 1.4 changes this message to:
+ For input string: "3Clothing"
+ -->
+ <assert-output name="Outer Message">
+ 3Clothing
+ </assert-output>
+
+ <assert-output name="Inner Exception">
+ java.lang.NumberFormatException
+ </assert-output>
+
+ </request>
+
+ <!-- Test the index and listener parameters, and using an array
+ as the source. -->
+
+ <request>
+ <parameter name="service" value="page" />
+ <parameter name="page" value="ListEditArray" />
+
+ <assert-output name="Page Title">
+ <![CDATA[
<title>ListEdit Array</title>
-]]>
- </assert-output>
-
- <assert-output-matches name="Hidden Fields" subgroup="1">
-<![CDATA[
+]]>
+ </assert-output>
+
+ <assert-output-matches name="Hidden Fields" subgroup="1">
+ <![CDATA[
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
- <match>name="formids" value="e"</match>
- <match>name="component" value="$ListEditForm.$Form"</match>
- <match>name="page" value="ListEditArray"</match>
- <match>name="service" value="direct"</match>
- <match>name="submitmode" value=""</match>
- <match>name="submitname" value=""</match>
- <match>name="e" value="SFred"</match>
- <match>name="e" value="SDino"</match>
- <match>name="e" value="SWilma"</match>
- </assert-output-matches>
- </request>
-
- <!-- Test where the ListEdit gets a null source. -->
-
- <request>
- <parameter name="service" value="page" />
- <parameter name="page" value="ListEditNull" />
-
- <assert-output name="Page Title">
-<![CDATA[
+ <match>name="formids" value="e"</match>
+ <match>name="seedids" value="BrO0ABXcnACUsU2hlbGwkMCxCb2R5JDAsTGlzdEVkaXRGb3JtJDAsRm9ybSQw"</match>
+ <match>name="component" value="$ListEditForm.$Form"</match>
+ <match>name="page" value="ListEditArray"</match>
+ <match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
+ <match>name="submitname" value=""</match>
+ <match>name="e" value="SFred"</match>
+ <match>name="e" value="SDino"</match>
+ <match>name="e" value="SWilma"</match>
+ </assert-output-matches>
+ </request>
+
+ <!-- Test where the ListEdit gets a null source. -->
+
+ <request>
+ <parameter name="service" value="page" />
+ <parameter name="page" value="ListEditNull" />
+
+ <assert-output name="Page Title">
+ <![CDATA[
<title>ListEdit Null</title>
-]]>
- </assert-output>
-
- <assert-output-matches name="Hidden Fields" subgroup="1">
-<![CDATA[
+]]>
+ </assert-output>
+
+ <assert-output-matches name="Hidden Fields" subgroup="1">
+ <![CDATA[
<input type="hidden" (name="(.*?)" value="(.*?)") />
]]>
- <match>name="formids" value="e"</match>
- <match>name="component" value="$ListEditForm.$Form"</match>
- <match>name="page" value="ListEditNull"</match>
- <match>name="service" value="direct"</match>
- <match>name="submitmode" value=""</match>
- <match>name="submitname" value=""</match>
-
- </assert-output-matches>
- </request>
+ <match>name="formids" value="e"</match>
+ <match>name="seedids" value="BrO0ABXcnACUsU2hlbGwkMCxCb2R5JDAsTGlzdEVkaXRGb3JtJDAsRm9ybSQw"</match>
+ <match>name="component" value="$ListEditForm.$Form"</match>
+ <match>name="page" value="ListEditNull"</match>
+ <match>name="service" value="direct"</match>
+ <match>name="submitmode" value=""</match>
+ <match>name="submitname" value=""</match>
+
+ </assert-output-matches>
+ </request>
</mock-test>