You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/08/14 00:13:16 UTC

svn commit: r431254 - in /tapestry/tapestry4/trunk: tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/ tapestry-examples/Workbench/src/context/ tapestry-examples/Workbench/src/context/WEB-INF/ tapestry-framework/src/java/org/apache/tapestry...

Author: jkuhnert
Date: Sun Aug 13 15:13:14 2006
New Revision: 431254

URL: http://svn.apache.org/viewvc?rev=431254&view=rev
Log:
Added support for updateComponents/async/json to Form. 
Removed "ajaxEnabled" parameter from Shell as it really should be called "javascriptEnabled", but 
that doesn't really make sense as a parameter so I didn't create a replacement.
Added debugEnabled parameter to shell so people can turn browser log/debug statements completely 
on/off.
Refactored some of the form.js XHR binding logic to be a little smarter about incoming parameters 
and setting of the correct header flags for json vs ajax responses.

Modified:
    tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
    tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/Dates.html
    tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/Border.html
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IForm.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/PageRenderSupport.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Body.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ElementEvent.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseContributorImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
    tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/html/TestInsertText.java
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java

Modified: tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/src/java/org/apache/tapestry/contrib/palette/Palette.java Sun Aug 13 15:13:14 2006
@@ -397,7 +397,7 @@
             String symbolName, IAsset asset)
     {
         String url = asset.buildURL();
-        String reference = pageRenderSupport.getPreloadedImageReference(url);
+        String reference = pageRenderSupport.getPreloadedImageReference(this, url);
 
         _symbols.put(symbolName, reference);
     }

Modified: tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/Dates.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/Dates.html?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/Dates.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/Dates.html Sun Aug 13 15:13:14 2006
@@ -8,7 +8,9 @@
 
 <span jwcid="showError"/>
 
-<form jwcid="@Form" delegate="bean:delegate" clientValidationEnabled="ognl:clientValidationEnabled">
+<form jwcid="@Form" delegate="bean:delegate" 
+		clientValidationEnabled="ognl:clientValidationEnabled" 
+		async="ognl:true" updateComponents="ognl:{'dateDisplay'}" >
 
 <table valign="middle">
  <tr>
@@ -34,6 +36,7 @@
 
 </form>
 
+<div jwcid="dateDisplay@Any">
 <u>Submitted Dates</u><br/>
 
 <table valign="middle">
@@ -47,4 +50,6 @@
 		<span jwcid="@Insert" value="ognl:endDate"/>
 		</td></tr>
 </table>
+</div>
+
 </span>

Modified: tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/Border.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/Border.html?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/Border.html (original)
+++ tapestry/tapestry4/trunk/tapestry-examples/Workbench/src/context/WEB-INF/Border.html Sun Aug 13 15:13:14 2006
@@ -1,5 +1,5 @@
 <html jwcid="@Shell" stylesheet="asset:stylesheet" 
-	title="message:window.title" browserLogLevel="literal:DEBUG" >
+	title="message:window.title" browserLogLevel="literal:DEBUG" debugEnabled="ognl:false">
 <body jwcid="@Body">
 
 <table class="tabs" cellspacing="0" border="0">

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/ComponentEvent.script Sun Aug 13 15:13:14 2006
@@ -39,7 +39,7 @@
                    tapestry.form.setFormValidating("${formName}", validateForm);
                    
                     <if expression="formEvent[2]">
-                    tapestry.form.submitAsync("${formName}", content, null, validateForm);
+                    tapestry.form.submitAsync("${formName}", content);
                     </if>
                     <if-not expression="formEvent[2]">
                     tapestry.form.submit("${formName}");

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IForm.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IForm.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IForm.java Sun Aug 13 15:13:14 2006
@@ -27,7 +27,7 @@
  * @since 1.0.2
  */
 
-public interface IForm extends IComponent, FormBehavior
+public interface IForm extends IComponent, FormBehavior, IDirect
 {
     /**
      * Invoked by the {@link IRequestCycle}to allow a form that uses the direct service, to respond

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/IRequestCycle.java Sun Aug 13 15:13:14 2006
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry;
 
+import java.util.Iterator;
+
 import org.apache.tapestry.engine.IEngineService;
 import org.apache.tapestry.services.Infrastructure;
 import org.apache.tapestry.services.ResponseBuilder;
@@ -183,6 +185,13 @@
      *          located; the return value -1  indicates that the object is not on the stack.
      */
     int renderStackSearch(IRender render);
+    
+    /**
+     * Creates a traversable iterator for moving through the stack.
+     * 
+     * @return An iterator over the current stack.
+     */
+    Iterator renderStackIterator();
     
     /**
      * Removes a previously stored attribute, if one with the given name exists.

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/PageRenderSupport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/PageRenderSupport.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/PageRenderSupport.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/PageRenderSupport.java Sun Aug 13 15:13:14 2006
@@ -30,7 +30,21 @@
      * a snippet of JavaScript expression that can be inserted into some larger block of JavaScript
      * as a function parameter, or as a property assignment. A typical return value might be
      * <code>tapestry_preload[7].src</code>.
+     * 
+     * @deprecated To be removed in 4.2, use {@link #getPreloadedImageReference(IComponent, String)} instead.
      */
 
     String getPreloadedImageReference(String url);
+    
+    /**
+     * Sets up the given URL to preload, and returns a reference to the loaded image, in the form of
+     * a snippet of JavaScript expression that can be inserted into some larger block of JavaScript
+     * as a function parameter, or as a property assignment. A typical return value might be
+     * <code>tapestry_preload[7].src</code>.
+     * 
+     * @param target The component url being loaded for
+     * @param url The asset URL to preload
+     */
+    
+    String getPreloadedImageReference(IComponent target, String url);
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/AjaxShellDelegate.java Sun Aug 13 15:13:14 2006
@@ -49,6 +49,8 @@
     
     private String _browserLogLevel = BROWSER_LOG_WARNING;
     
+    private boolean _debug;
+    
     /**
      * {@inheritDoc}
      */
@@ -58,7 +60,7 @@
         
         // first configure dojo, has to happen before package include
         StringBuffer str = new StringBuffer("<script type=\"text/javascript\">");
-        str.append("djConfig = { isDebug: true,")
+        str.append("djConfig = { isDebug: ").append(_debug).append(",")
         .append(" debugContainerId:'debug',")
         .append(" baseRelativePath:\"")
         .append(_assetService.getLink(true,
@@ -107,6 +109,16 @@
         Defense.notNull("level", level);
         
         _browserLogLevel = level;
+    }
+    
+    /**
+     * Allows for turning browser debugging on/off.
+     * 
+     * @param debug If false, no logging output will be written.
+     */
+    public void setDebug(boolean debug)
+    {
+        _debug = debug;
     }
     
     /**

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/dojo/html/WidgetEvent.script Sun Aug 13 15:13:14 2006
@@ -39,7 +39,7 @@
                    tapestry.form.setFormValidating("${formName}", validateForm);
                    
                     <if expression="formEvent[2]">
-                    tapestry.form.submitAsync("${formName}", content, null, validateForm);
+                    tapestry.form.submitAsync("${formName}", content);
                     </if>
                     <if-not expression="formEvent[2]">
                     tapestry.form.submit("${formName}");

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/engine/RequestCycle.java Sun Aug 13 15:13:14 2006
@@ -348,7 +348,15 @@
     {
         return _renderStack.search(render);
     }
-
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator renderStackIterator()
+    {
+        return _renderStack.iterator();
+    }
+    
     public boolean isRewinding()
     {
         return _rewinding;

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.java Sun Aug 13 15:13:14 2006
@@ -18,7 +18,6 @@
 import org.apache.tapestry.AbstractComponent;
 import org.apache.tapestry.IActionListener;
 import org.apache.tapestry.IComponent;
-import org.apache.tapestry.IDirect;
 import org.apache.tapestry.IForm;
 import org.apache.tapestry.IMarkupWriter;
 import org.apache.tapestry.IRender;
@@ -35,31 +34,32 @@
 import org.apache.tapestry.web.WebResponse;
 
 /**
- * Component which contains form element components. Forms use the action or direct services to
- * handle the form submission. A Form will wrap other components and static HTML, including form
- * components such as {@link TextArea}, {@link TextField}, {@link Checkbox}, etc. [ <a
- * href="../../../../../ComponentReference/Form.html">Component Reference </a>]
+ * Component which contains form element components. A Form will wrap other components and 
+ * static HTML, including form components such as {@link TextArea}, {@link TextField}, 
+ * {@link Checkbox}, etc. [ <a href="../../../../../ComponentReference/Form.html">Component Reference </a>]
+ * 
  * <p>
  * When a form is submitted, it continues through the rewind cycle until <em>after</em> all of its
  * wrapped elements have renderred. As the form component render (in the rewind cycle), they will be
  * updating properties of the containing page and notifying thier listeners. Again: each form
  * component is responsible not only for rendering HTML (to present the form), but for handling it's
  * share of the form submission.
+ * </p>
+ * 
  * <p>
  * Only after all that is done will the Form notify its listener.
- * <p>
- * Starting in release 1.0.2, a Form can use either the direct service or the action service. The
- * default is the direct service, even though in earlier releases, only the action service was
- * available.
+ * </p>
+ * 
  * <p>
  * Release 4.0 adds two new listeners, {@link #getCancel()} and {@link #getRefresh()} and
  * corresponding client-side behavior to force a form to refresh (update, bypassing input field
  * validation) or cancel (update immediately).
+ * </p>
  * 
  * @author Howard Lewis Ship, David Solis
  */
 
-public abstract class Form extends AbstractComponent implements IForm, IDirect
+public abstract class Form extends AbstractComponent implements IForm
 {
     private String _name;
 
@@ -304,6 +304,7 @@
     private ILink getLink(IRequestCycle cycle)
     {
         Object parameter = new DirectServiceParameter(this);
+        
         return getDirectService().getLink(true, parameter);
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.js?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.js Sun Aug 13 15:13:14 2006
@@ -13,6 +13,7 @@
 // limitations under the License.
 
 // Define a Tapestry object to contain most functions.
+// WARNING!: This file is now deprecated, it will be removed in Tapestry 4.2
 
 var Tapestry = new Object();
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/Form.jwc Sun Aug 13 15:13:14 2006
@@ -1,122 +1,122 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 
-   Copyright 2004, 2005 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.
+    Copyright 2004, 2005 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.
 -->
 
 <!DOCTYPE component-specification PUBLIC 
   "-//Apache Software Foundation//Tapestry Specification 4.0//EN" 
   "http://tapestry.apache.org/dtd/Tapestry_4_0.dtd">
-  
+
 <component-specification class="org.apache.tapestry.form.Form">
 
-  <!-- Note: remember to keep Go.jwc synchronized with any changes here! -->  
-    
-  <description>
-  Used to implement an HTML form.
-  </description>
-
-  <bean name="defaultDelegate" class="org.apache.tapestry.valid.ValidationDelegate"/>
-  
-  <parameter name="method" default-value="literal:post">
-    <description>
-    The method used by the form when it is submitted, defaults to "post".
-    </description>
-  </parameter>
-  
-
-<parameter name="success">
-  <description>
-    Object invoked when the form is submitted normally (not a cancel or a refresh) and
-    the validation delegate contains no errors.
-  </description>
-</parameter>    
-
-  <parameter name="cancel">
-      <description>
-          Object invoked when the form is cancelled (a special type of form submission).
-          The cancel listener (if any) overrides the standard listener. Other properties
-          will not be affected by the rewind.
-       </description>
-   </parameter>
-  
-  <parameter name="refresh">
-      <description>
-          Object invoked when the form is refreshed (a special type of form submission).
-          The refresh listener (if any) overrides the standard listener.
-          Other properties managed by enclosed components will be updated.
-      </description>
-  </parameter>    
+    <!-- Note: remember to keep Go.jwc synchronized with any changes here! -->
+
+    <description>Used to implement an HTML form.</description>
+
+    <bean name="defaultDelegate" class="org.apache.tapestry.valid.ValidationDelegate" />
+
+    <parameter name="method" default-value="literal:post">
+        <description>
+            The method used by the form when it is submitted, defaults to "post".
+        </description>
+    </parameter>
+
+    <parameter name="success">
+        <description>
+            Object invoked when the form is submitted normally (not a cancel or a refresh) and the
+            validation delegate contains no errors.
+        </description>
+    </parameter>
+
+    <parameter name="cancel">
+        <description>
+            Object invoked when the form is cancelled (a special type of form submission). The
+            cancel listener (if any) overrides the standard listener. Other properties will not be
+            affected by the rewind.
+        </description>
+    </parameter>
+
+    <parameter name="refresh">
+        <description>
+            Object invoked when the form is refreshed (a special type of form submission). The
+            refresh listener (if any) overrides the standard listener. Other properties managed by
+            enclosed components will be updated.
+        </description>
+    </parameter>
 
     <parameter name="listener">
+        <description>Default listener used when no other listener is invoked.</description>
+    </parameter>
+
+    <parameter name="stateful" default-value="true">
+        <description>
+            If true (the default), then an active session is required when the form is submitted, if
+            there was an active session when the form was rendered.
+        </description>
+    </parameter>
+
+    <parameter name="delegate" default-value="bean:defaultDelegate">
+        <description>
+            Specifies the delegate to be used by fields to track input errors. If not specified, the
+            Form provides a default instance of org.apache.tapestry.valid.ValidationDelegate.
+        </description>
+    </parameter>
+
+    <parameter name="clientValidationEnabled">
+        <description>
+            If true then client-side validation will be generated upon render for any required or
+            validating fields.
+        </description>
+    </parameter>
+
+    <parameter name="focus" default-value="true">
         <description>
-            Default listener used when no other listener is invoked.
+            If true (the default), then the form will attempt to get field focus on the first field
+            in error (or first required field, or just first field) within the form. Set to false to
+            allow a different Form on the same page to claim field focus.
         </description>
     </parameter>
-  
-  <parameter name="stateful" default-value="true">
-    <description>
-    If true (the default), then an active session is required when the
-        form is submitted, if there was an active session when the
-        form was rendered.
-    </description>
-  </parameter>
-  
-  <parameter name="delegate" default-value="bean:defaultDelegate">
-    <description>
-    Specifies the delegate to be used by fields to track input errors. If not specified, the
-        Form provides a default instance of org.apache.tapestry.valid.ValidationDelegate.
-    </description>
-  </parameter>
-  
-  <parameter name="clientValidationEnabled">
-    <description>
-    If true then client-side validation will be generated upon render for any
-        required or validating fields.
-	</description>
-  </parameter>
-  
-  <parameter name="focus" default-value="true">
-    <description>
-      If true (the default), then the form will attempt to get field focus on the first
-      field in error (or first required field, or just first field) within the form.
-      Set to false to allow a different Form on the same page to claim field focus.
-    </description>
-  </parameter>
-  
-  <parameter name="scheme">
-    <description>
-    Forces the link to be generated as an absolute URL with the given scheme
-    (unless the scheme matches the scheme for the current request).
-    </description>
-  </parameter>    
-  
-  <parameter name="port">
-    <description>
-    Forces the link to be generated as an absolute URL with the given port
-    (unless the port matches the port for the current request).
-    </description>
-  </parameter>    
-  
-  <reserved-parameter name="action"/>
-  <reserved-parameter name="name"/>
-  <reserved-parameter name="onsubmit"/>
-  <reserved-parameter name="onreset"/>
-  <reserved-parameter name="enctype"/>
-  <reserved-parameter name="id"/>
-  
-  <inject property="directService" object="engine-service:direct"/>
-  <inject property="response" object="infrastructure:response"/>
-  <inject property="listenerInvoker" object="infrastructure:listenerInvoker"/>
+
+    <parameter name="scheme">
+        <description>
+            Forces the link to be generated as an absolute URL with the given scheme (unless the
+            scheme matches the scheme for the current request).
+        </description>
+    </parameter>
+
+    <parameter name="port">
+        <description>
+            Forces the link to be generated as an absolute URL with the given port (unless the port
+            matches the port for the current request).
+        </description>
+    </parameter>
+
+    <parameter name="updateComponents" />
+
+    <parameter name="json" default-value="false" />
+
+    <parameter name="async" default-value="false" />
+
+    <reserved-parameter name="action" />
+    <reserved-parameter name="name" />
+    <reserved-parameter name="onsubmit" />
+    <reserved-parameter name="onreset" />
+    <reserved-parameter name="enctype" />
+    <reserved-parameter name="id" />
+
+    <inject property="directService" object="engine-service:direct" />
+    <inject property="response" object="infrastructure:response" />
+    <inject property="listenerInvoker" object="infrastructure:listenerInvoker" />
 </component-specification>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/form/FormSupportImpl.java Sun Aug 13 15:13:14 2006
@@ -497,6 +497,7 @@
         runDeferredRunnables();
         
         int portI = (port == null) ? 0 : port.intValue();
+        
         writeTag(_writer, method, link.getURL(scheme, null, portI, null, false));
         
         // For XHTML compatibility
@@ -558,8 +559,22 @@
         if (_pageRenderSupport == null)
             return;
         
-        _pageRenderSupport.addInitializationScript(_form, "dojo.require(\"tapestry.form\");"
-                + "tapestry.form.registerForm('" + formId + "');");
+        StringBuffer str = new StringBuffer("dojo.require(\"tapestry.form\");");
+        str.append("tapestry.form.registerForm(\"").append(formId).append("\"");
+        
+        if (_form.isAsync()) {
+            
+            str.append(", true");
+            
+            if (_form.isJson()) {
+                str.append(", true");
+            }
+        }
+        
+        str.append(");");
+        
+        
+        _pageRenderSupport.addInitializationScript(_form, str.toString());
     }
     
     public String rewind()

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Body.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Body.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Body.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Body.java Sun Aug 13 15:13:14 2006
@@ -40,12 +40,21 @@
     private PageRenderSupportImpl _pageRenderSupport;
 
     /**
+     * {@inheritDoc}
+     */
+    public String getPreloadedImageReference(IComponent target, String URL)
+    {
+        return _pageRenderSupport.getPreloadedImageReference(target, URL);
+    }
+    
+    /**
      * Adds to the script an initialization for the named variable as an Image(), to the given URL.
      * <p>
      * Returns a reference, a string that can be used to represent the preloaded image in a
      * JavaScript function.
      * 
      * @since 1.0.2
+     * @deprecated To be removed in 4.2, use {@link #getPreloadedImageReference(IComponent, String)} instead.
      */
 
     public String getPreloadedImageReference(String URL)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ElementEvent.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ElementEvent.script?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ElementEvent.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/ElementEvent.script Sun Aug 13 15:13:14 2006
@@ -38,7 +38,7 @@
                    tapestry.form.setFormValidating("${formName}", validateForm);
                    
                     <if expression="formEvent[2]">
-                    tapestry.form.submitAsync("${formName}", content, null, validateForm);
+                    tapestry.form.submitAsync("${formName}", content);
                     </if>
                     <if-not expression="formEvent[2]">
                     tapestry.form.submit("${formName}");

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Rollover.java Sun Aug 13 15:13:14 2006
@@ -132,9 +132,9 @@
     {
         String imageId = pageRenderSupport.getUniqueString(getId());
         String preloadedMouseOverImageURL = pageRenderSupport
-                .getPreloadedImageReference(mouseOverImageURL);
+                .getPreloadedImageReference(this, mouseOverImageURL);
         String preloadedMouseOutImageURL = pageRenderSupport
-                .getPreloadedImageReference(mouseOutImageURL);
+                .getPreloadedImageReference(this, mouseOutImageURL);
 
         Map symbols = new HashMap();
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.java Sun Aug 13 15:13:14 2006
@@ -105,9 +105,9 @@
             
             IRender ajaxDelegate = getAjaxDelegate();
             
-            if (isAjaxEnabled() && ajaxDelegate != null)
+            if (ajaxDelegate != null)
                 ajaxDelegate.render(writer, cycle);
-
+            
             List relations = getRelations();
             if (relations != null)
                 writeRelations(writer, relations);            
@@ -274,8 +274,6 @@
     }
     
     public abstract boolean isDisableCaching();
-    
-    public abstract boolean isAjaxEnabled();
     
     public abstract IRender getAjaxDelegate();
     

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/html/Shell.jwc Sun Aug 13 15:13:14 2006
@@ -121,12 +121,10 @@
     </description>
   </parameter>
   
-  <parameter name="ajaxEnabled" 
-             default-value="true" >
-     <description>
-     If set to true, will include the required javascript libraries that make all
-     of the ajax functionality possible.
-     </description>
+  <parameter name="debugEnabled" default-value="ognl:true">
+    <description>
+    Allows turning browser debug logging statements on/off.
+    </description>
   </parameter>
   
   <parameter name="tapestrySource" 
@@ -163,6 +161,7 @@
    <set name="dojoPath" value="dojoPath" />
    <set name="tapestrySource" value="tapestrySource" />
    <set name="logLevel" value="browserLogLevel" />
+   <set name="debug" value="debugEnabled" />
   </bean>
   
   <asset name="defaultDojoSource" path="classpath:/dojo/dojo.js" />

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/link/DirectLinkWorker.script Sun Aug 13 15:13:14 2006
@@ -19,11 +19,10 @@
             tapestry.event.buildEventProperties(e, content);
             if (!content["beventtarget.id"]) content["beventtarget.id"]="${component.clientId}";
             
-            if (typeof e == "undefined" || typeof e.target == "undefined"
-                || typeof e.target["getAttribute"] == "undefined"
+            if (dj_undef("target", e) || dj_undef("getAttribute", e.target)
                 || !e.target.getAttribute("href")) {
                 dojo.raise("Error, link target not found or invalid " + e);
-                return;    
+                return;
             }
             
             tapestry.bind(e.target.getAttribute("href"), content, ${json});

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/ResponseBuilder.java Sun Aug 13 15:13:14 2006
@@ -242,6 +242,16 @@
     IMarkupWriter getWriter(String id, String type);
     
     /**
+     * Determines if the specified component should have any asset image URL
+     * references embedded in the response.
+     * 
+     * @param target
+     *          The component to allow/disallow image initialization script content from.
+     * @return True if the component script should be allowed.
+     */
+    boolean isImageInitializationAllowed(IComponent target);
+    
+    /**
      * Determines if the specified component should have its javascript 
      * body added to the response.
      * 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DefaultResponseBuilder.java Sun Aug 13 15:13:14 2006
@@ -184,6 +184,14 @@
         return true;
     }
     
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isImageInitializationAllowed(IComponent target)
+    {
+        return true;
+    }
+    
     /** 
      * {@inheritDoc}
      */

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/DojoAjaxResponseBuilder.java Sun Aug 13 15:13:14 2006
@@ -213,6 +213,19 @@
         return contains(target);
     }
     
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isImageInitializationAllowed(IComponent target)
+    {
+        if (target != null 
+                && IForm.class.isInstance(target)
+                && ((IForm)target).isFormFieldUpdating())
+            return true;
+        
+        return contains(target);
+    }
+    
     /** 
      * {@inheritDoc}
      */
@@ -482,10 +495,15 @@
         if (_parts.contains(id))
             return true;
         
-        IComponent parent = (IComponent)_cycle.renderStackPeek();
-        
-        if (parent != null && parent != target)
-            return contains(parent);
+        Iterator it = _cycle.renderStackIterator();
+        while (it.hasNext()) {
+            
+            IComponent comp = (IComponent)it.next();
+            String compId = getComponentId(comp);
+            
+            if (comp != target && _parts.contains(compId))
+                return true;
+        }
         
         return false;
     }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseBuilder.java Sun Aug 13 15:13:14 2006
@@ -205,6 +205,14 @@
         return false;
     }
     
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isImageInitializationAllowed(IComponent target)
+    {
+        return false;
+    }
+    
     /** 
      * {@inheritDoc}
      */

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseContributorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseContributorImpl.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseContributorImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/services/impl/JSONResponseContributorImpl.java Sun Aug 13 15:13:14 2006
@@ -58,6 +58,7 @@
     public boolean handlesResponse(IRequestCycle cycle)
     {
         String parm = cycle.getParameter(JSON_HEADER);
+        
         if (parm != null && Boolean.valueOf(parm).booleanValue())
             return true;
         if (_webRequest.getHeader(JSON_HEADER) != null)

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/java/org/apache/tapestry/util/PageRenderSupportImpl.java Sun Aug 13 15:13:14 2006
@@ -98,12 +98,20 @@
     {
         return _location;
     }
-
+    
     public String getPreloadedImageReference(String URL)
     {
+        return getPreloadedImageReference(null, URL);
+    }
+    
+    public String getPreloadedImageReference(IComponent target, String URL)
+    {
+        if (target != null && !_builder.isImageInitializationAllowed(target))
+            return URL;
+        
         if (_imageMap == null)
             _imageMap = new HashMap();
-
+        
         String reference = (String) _imageMap.get(URL);
 
         if (reference == null)
@@ -207,7 +215,7 @@
     /**
      * Writes a single large JavaScript block containing:
      * <ul>
-     * <li>Any image initializations (via {@link #getPreloadedImageReference(String)}).
+     * <li>Any image initializations (via {@link #getPreloadedImageReference(IComponent, String)}).
      * <li>Any included scripts (via {@link #addExternalScript(Resource)}).
      * <li>Any contributions (via {@link #addBodyScript(String)}).
      * </ul>

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/core.js Sun Aug 13 15:13:14 2006
@@ -39,8 +39,9 @@
 		};
 		
 		// setup content type
-		if (typeof json != "undefined" && json) {
+		if (typeof json != "undefined" && json == true) {
 			parms.mimetype = "text/json";
+			parms.headers={"json":true};
 		} else {
 			parms.headers={"dojo-ajax-request":true};
 			parms.mimetype="text/xml";

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/tapestry/form.js Sun Aug 13 15:13:14 2006
@@ -28,7 +28,9 @@
     	this.focusField(field);
 	},
 	
-	invalid_field:function(field, message){tapestry.form.invalidField(field, message); },
+	invalid_field:function(field, message){
+		tapestry.form.invalidField(field, message); 
+	},
 	
 	/**
 	 * If possible, brings keyboard input focus
@@ -103,24 +105,37 @@
 	/**
 	 * Registers the form with the local <code>forms</code> property so 
 	 * that there is a central reference of all tapestry forms.
+	 * 
 	 * @param id The form(form id) to register.
+	 * @param async Boolean, if true causes form submission to be asynchronous.
+	 * @param json Boolean, if true causes form submission to be asyncrhronous with an 
+	 * 			   expected JSON response.
 	 */
-	registerForm:function(id){
+	registerForm:function(id, async, json){
 		var form=dojo.byId(id);
 		if (!form) {
 			dojo.raise("Form not found with id " + id);
 			return;
 		}
 		
-		// make sure id is correct just in case node passed in
+		// make sure id is correct just in case node passed in has only name
 		id=(form.getAttribute("id") ) ? form.getAttribute("id") : form.getAttribute("name");
 		
 		if (!this.forms[id]) {
 			this.forms[id]={};
 			this.forms[id].validateForm=true;
 			this.forms[id].profiles=[];
+			this.forms[id].async=(typeof async != "undefined") ? async : false;
+			this.forms[id].json=(typeof json != "undefined") ? json : false;
 			
-			dojo.event.connect(form, "onsubmit", this, "onFormSubmit");
+			if (!this.forms[id].async) {
+				dojo.event.connect(form, "onsubmit", this, "onFormSubmit");
+			} else {
+				dojo.event.connect(form, "onsubmit", function(e) {
+					dojo.event.browser.stopEvent(e);
+					tapestry.form.submitAsync(form);
+				});
+			}
 		} else {
 			dojo.log.warn("registerForm(" + id + ") Form already registered.");
 		}
@@ -264,9 +279,8 @@
 	 * 				  event parameters to form submission, but can be any
 	 * 				  typical form/value pair.
 	 * @param submitName Optional submit name string to use when submitting.
-	 * @param validate Whether or not to validate form, default is false.
 	 */
-	submitAsync:function(form, content, submitName, validate){
+	submitAsync:function(form, content, submitName){
 		var form=dojo.byId(form);
 		if (!form) {
 			dojo.raise("Form not found with id " + id);
@@ -274,7 +288,7 @@
 		}
 		var formId=form.getAttribute("id");
 		
-		if (validate && !tapestry.form.validation.validateForm(form, this.forms[formId])) {
+		if (!tapestry.form.validation.validateForm(form, this.forms[formId])) {
 			dojo.log.debug("Form validation failed for form with id " + formId);
 			return;
 		}
@@ -282,17 +296,26 @@
 		if (submitName){
 			form.submitname.value=submitName;
 		}
-		dojo.io.bind({
+		
+		var parms={
 			formNode:form,
 			content:content,
-            headers:{"dojo-ajax-request":true},
             useCache:true,
             preventCache:true,
-            load: (function(){tapestry.load.apply(this, arguments);}),
             error: (function(){tapestry.error.apply(this, arguments);}),
-            mimetype: "text/xml",
             encoding: "UTF-8"
-        });
+		};
+		
+		if (this.forms[formId].json) {
+			parms.headers={"json":true};
+			parms.mimetype="text/json";
+		} else {
+			parms.headers={"dojo-ajax-request":true};
+			parms.mimetype="text/xml";
+			parms.load=(function(){tapestry.load.apply(this, arguments);});
+		}
+		
+		dojo.io.bind(parms);
 	}
 }
 

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/FormSupportTest.java Sun Aug 13 15:13:14 2006
@@ -757,7 +757,7 @@
         writer.attribute("action", "/app");
         
         writer.attribute("id", "myform");
-
+        
         support.addInitializationScript(form, "Tapestry.onreset('myform', function (event)"
                 + "\n{\n  myReset1();\n  myReset2();\n});\n");
         
@@ -1466,6 +1466,6 @@
     private void trainRegister(PageRenderSupport support, IForm form, String formId)
     {
         support.addInitializationScript(form, "dojo.require(\"tapestry.form\");"
-                + "tapestry.form.registerForm('" + formId + "');");
+                + "tapestry.form.registerForm(\"" + formId + "\");");
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/form/MockForm.java Sun Aug 13 15:13:14 2006
@@ -16,6 +16,7 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -423,4 +424,46 @@
     {
         
     }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public Collection getUpdateComponents()
+    {
+        return Collections.EMPTY_LIST;
+    }
+    
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isAsync()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isJson()
+    {
+        // TODO Auto-generated method stub
+        return false;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public boolean isStateful()
+    {
+        return false;
+    }
+
+    /** 
+     * {@inheritDoc}
+     */
+    public void trigger(IRequestCycle cycle)
+    {
+    }
+    
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/html/TestInsertText.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/html/TestInsertText.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/html/TestInsertText.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/html/TestInsertText.java Sun Aug 13 15:13:14 2006
@@ -149,4 +149,30 @@
 
         verify();
     }
+    
+    public void test_Render_Nested_Raw()
+    {
+        IMarkupWriter writer = newBufferWriter();
+        IRequestCycle cycle = newCycle(false);
+        
+        InsertText component = newInstance(InsertText.class, 
+                new Object[] { "value", "output\n<b>raw</b>", "raw", Boolean.TRUE });
+        
+        expect(cycle.renderStackPush(component)).andReturn(component);
+        
+        IMarkupWriter nested = writer.getNestedWriter();
+        
+        expect(cycle.renderStackPop()).andReturn(component);
+        
+        replay();
+
+        component.finishLoad(cycle, null, null);
+        component.render(nested, cycle);
+        
+        verify();
+        
+        nested.close();
+        
+        assertBuffer("output<br/><b>raw</b>");
+    }
 }

Modified: tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java?rev=431254&r1=431253&r2=431254&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java Sun Aug 13 15:13:14 2006
@@ -22,6 +22,7 @@
 import java.io.CharArrayWriter;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 import org.apache.tapestry.BaseComponentTestCase;
@@ -179,13 +180,13 @@
         
         expect(comp.getClientId()).andReturn("comp");
         
-        expect(cycle.renderStackPeek()).andReturn(null);
+        expect(cycle.renderStackIterator()).andReturn(Collections.EMPTY_LIST.iterator());
         
         expect(comp.getClientId()).andReturn("comp1");
         
         expect(comp.getClientId()).andReturn("comp");
         
-        expect(cycle.renderStackPeek()).andReturn(null);
+        expect(cycle.renderStackIterator()).andReturn(Collections.EMPTY_LIST.iterator());
         
         replay();