tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r699719 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/corelib/pages/ main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/services/ main/resources/org/apache/tapestry5/ test/app...
Date Sat, 27 Sep 2008 19:04:04 GMT
Author: hlship
Date: Sat Sep 27 12:04:03 2008
New Revision: 699719

URL: http://svn.apache.org/viewvc?rev=699719&view=rev
Log:
TAP5-233: Ajax requests that fail give no indication on the client side; instead, an error
should be presented to the user as some form of popup

Added:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/IncludedStylesheet.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Dispatcher.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/RequestExceptionHandler.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
    tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
Sat Sep 27 12:04:03 2008
@@ -22,10 +22,8 @@
 import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.services.ExceptionReporter;
 import org.apache.tapestry5.services.Request;
-import org.apache.tapestry5.services.Response;
 import org.apache.tapestry5.services.Session;
 
-import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -64,14 +62,6 @@
 
     private final String pathSeparator = System.getProperty(PATH_SEPARATOR_PROPERTY);
 
-    @Inject
-    private Response response;
-
-    void setupRender()
-    {
-        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-    }
-
     public void reportException(Throwable exception)
     {
         rootException = exception;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultRequestExceptionHandler.java
Sat Sep 27 12:04:03 2008
@@ -18,10 +18,13 @@
 import org.apache.tapestry5.internal.structure.Page;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.annotations.Symbol;
+import org.apache.tapestry5.ioc.internal.util.InternalUtils;
 import org.apache.tapestry5.services.ExceptionReporter;
 import org.apache.tapestry5.services.RequestExceptionHandler;
+import org.apache.tapestry5.services.Response;
 import org.slf4j.Logger;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
 /**
@@ -38,21 +41,31 @@
 
     private final String pageName;
 
+    private final Response response;
+
     public DefaultRequestExceptionHandler(RequestPageCache pageCache, PageResponseRenderer
renderer, Logger logger,
 
                                           @Inject @Symbol(SymbolConstants.EXCEPTION_REPORT_PAGE)
-                                          String pageName)
+                                          String pageName,
+
+                                          Response response)
     {
         this.pageCache = pageCache;
         this.renderer = renderer;
         this.logger = logger;
         this.pageName = pageName;
+        this.response = response;
     }
 
     public void handleRequestException(Throwable exception) throws IOException
     {
         logger.error(ServicesMessages.requestException(exception), exception);
 
+        // TAP5-233: Make sure the client knows that an error occurred.
+
+        response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        response.setHeader("X-Tapestry-ErrorMessage", InternalUtils.toMessage(exception));
+
         Page page = pageCache.get(pageName);
 
         ExceptionReporter rootComponent = (ExceptionReporter) page.getRootComponent();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DocumentLinkerImpl.java
Sat Sep 27 12:04:03 2008
@@ -39,32 +39,6 @@
         developmentMode = !productionMode;
     }
 
-    private class IncludedStylesheet
-    {
-        private final String url;
-
-        private final String media;
-
-        IncludedStylesheet(String url, String media)
-        {
-            this.url = url;
-            this.media = media;
-        }
-
-        void add(Element head, int index)
-        {
-            head.elementAt(index, "link",
-
-                           "href", url,
-
-                           "rel", "stylesheet",
-
-                           "type", "text/css",
-
-                           "media", media);
-        }
-    }
-
     public void addStylesheetLink(String styleURL, String media)
     {
         if (stylesheets.contains(styleURL)) return;
@@ -108,30 +82,33 @@
 
         if (!root.getName().equals("html")) return;
 
-        int stylesheets = includedStylesheets.size();
-
-        if (stylesheets > 0)
-        {
-            Element head = root.find("head");
 
-            if (head == null) head = root.elementAt(0, "head");
+        if (!stylesheets.isEmpty())
+            addStylesheetsToHead(root, includedStylesheets);
 
-            for (int i = 0; i < stylesheets; i++)
-                includedStylesheets.get(i).add(head, i);
-        }
+        addScriptElementsToBody(root);
+    }
 
+    private void addScriptElementsToBody(Element root)
+    {
         Element body = root.find("body");
 
         if (body == null) return;
 
         // TAPESTRY-2364
 
+        if (!scripts.isEmpty()) addScriptLinksForIncludedScripts(body, scripts);
 
-        for (String scriptURL : scripts)
-        {
-            body.element("script", "src", scriptURL, "type", "text/javascript");
-        }
+        addDynamicScriptBlock(body);
+    }
 
+    /**
+     * Adds the dynamic script block, which is, ultimately, a call to the client-side Tapestry.onDOMLoaded()
function.
+     *
+     * @param body element to add the dynamic scripting to
+     */
+    protected void addDynamicScriptBlock(Element body)
+    {
         boolean blockNeeded = (developmentMode && !scripts.isEmpty()) || scriptBlock.length()
> 0;
 
         if (blockNeeded)
@@ -150,7 +127,38 @@
 
             e.raw("// -->\n");
         }
+    }
 
+    /**
+     * Adds a script link for each included script.  This is only invoked if there are scripts
to include.
+     *
+     * @param body    element to add the script links to
+     * @param scripts
+     */
+    protected void addScriptLinksForIncludedScripts(Element body, List<String> scripts)
+    {
+        for (String scriptURL : scripts)
+        {
+            body.element("script", "src", scriptURL, "type", "text/javascript");
+        }
     }
 
+    /**
+     * Locates the head element under the root ("html") element, creating it if necessary,
and adds the stylesheets to
+     * it.
+     *
+     * @param root        element of document
+     * @param stylesheets to add to the document
+     */
+    protected void addStylesheetsToHead(Element root, List<IncludedStylesheet> stylesheets)
+    {
+        Element head = root.find("head");
+
+        if (head == null) head = root.elementAt(0, "head");
+
+        int count = stylesheets.size();
+
+        for (int i = 0; i < count; i++)
+            stylesheets.get(i).add(head, i);
+    }
 }

Added: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/IncludedStylesheet.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/IncludedStylesheet.java?rev=699719&view=auto
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/IncludedStylesheet.java
(added)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/IncludedStylesheet.java
Sat Sep 27 12:04:03 2008
@@ -0,0 +1,53 @@
+//  Copyright 2008 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.
+
+package org.apache.tapestry5.internal.services;
+
+import org.apache.tapestry5.dom.Element;
+
+/**
+ * A stylesheet included in the rendered document by the {@link org.apache.tapestry5.internal.services.DocumentLinker}.
+ */
+public class IncludedStylesheet
+{
+    private final String url;
+
+    private final String media;
+
+    public IncludedStylesheet(String url, String media)
+    {
+        this.url = url;
+        this.media = media;
+    }
+
+
+    /**
+     * Invoked to add the stylesheet at a particular index under the head element.
+     *
+     * @param head  the head element of the document (i.e., html/head).
+     * @param index at which to add the stylesheet link
+     */
+    public void add(Element head, int index)
+    {
+        head.elementAt(index, "link",
+
+                       "href", url,
+
+                       "rel", "stylesheet",
+
+                       "type", "text/css",
+
+                       "media", media);
+    }
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Dispatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Dispatcher.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Dispatcher.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Dispatcher.java
Sat Sep 27 12:04:03 2008
@@ -18,19 +18,20 @@
 
 /**
  * A dispatcher is responsible for recognizing an incoming request. Dispatchers form an ordered
chain of command, with
- * each dispatcher responsible for recognizing requests that it can process.
+ * each dispatcher responsible for recognizing requests that it can process.  This is the
interface for the
+ * MasterDispatcher service, which takes an ordered configuration of Dispatchers (that is,
the chain of command
+ * pattern). If no dispatcher processes the request, it will utltimately be passed off to
the servlet container.
  *
  * @see org.apache.tapestry5.services.TapestryModule#contributeMasterDispatcher(org.apache.tapestry5.ioc.OrderedConfiguration,
- *      ClasspathAssetAliasManager, org.apache.tapestry5.internal.services.ResourceCache,
- *      org.apache.tapestry5.internal.services.ResourceStreamer, PageRenderRequestHandler,
ComponentEventRequestHandler,
- *      ComponentClassResolver, ContextValueEncoder, String)
+ *      org.apache.tapestry5.ioc.ObjectLocator)
  */
 public interface Dispatcher
 {
     /**
      * Analyzes the incoming request and performs an appropriate operation for each.
      *
-     * @return true if a response was delivered, false if the servlet container should be
allowed to handle the request
+     * @return true if a response was delivered, false if the dispatcher did not handle the
request (and a search for a
+     *         handler should continue)
      */
     boolean dispatch(Request request, Response response) throws IOException;
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/RequestExceptionHandler.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/RequestExceptionHandler.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/RequestExceptionHandler.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/RequestExceptionHandler.java
Sat Sep 27 12:04:03 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 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.
@@ -25,6 +25,11 @@
     /**
      * Reponsible for handling the error <em>in some way</em> and providing <em>some
response</em> to the client. A
      * default implementation may render an error response page.
+     * <p/>
+     * <p/>
+     * The handler is also responsible for setting the response status and the X-Tapestry-ErrorMessage
response header.
+     * These are very important in Ajax requests to allow the client-side logic to detect
the error and present it to
+     * the user.
      *
      * @param exception uncaught exception to be reported
      * @throws IOException

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
Sat Sep 27 12:04:03 2008
@@ -1563,14 +1563,14 @@
 
     /**
      * Contributes {@link PartialMarkupRendererFilter}s used when rendering a partial Ajax
response.  This is an analog
-     * to {@link #contributeMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration,
org.apache.tapestry5.Asset,
-     * org.apache.tapestry5.Asset, ValidationMessagesSource, org.apache.tapestry5.ioc.services.SymbolSource,
-     * AssetSource)} } and overlaps it to some degree. <dl> <dt>   PageRenderSupport
    </dt> <dd>Provides {@link
-     * org.apache.tapestry5.RenderSupport}</dd> <dt>ClientBehaviorSupport</dt>
<dd>Provides {@link
-     * org.apache.tapestry5.internal.services.ClientBehaviorSupport}</dd> <dt>Heartbeat</dt>
<dd>Provides {@link
-     * org.apache.tapestry5.services.Heartbeat}</dd> <dt>DefaultValidationDecorator</dt>
<dd>Provides {@link
-     * org.apache.tapestry5.ValidationDecorator} (as an instance of {@link org.apache.tapestry5.internal.DefaultValidationDecorator})</dd>
-     * </dl>
+     * to {@link #contributeMarkupRenderer(org.apache.tapestry5.ioc.OrderedConfiguration,
boolean,
+     * org.apache.tapestry5.Asset, org.apache.tapestry5.Asset, ValidationMessagesSource,
+     * org.apache.tapestry5.ioc.services.SymbolSource, AssetSource)}  } and overlaps it to
some degree. <dl> <dt>
+     * PageRenderSupport     </dt> <dd>Provides {@link org.apache.tapestry5.RenderSupport}</dd>
+     * <dt>ClientBehaviorSupport</dt> <dd>Provides {@link org.apache.tapestry5.internal.services.ClientBehaviorSupport}</dd>
+     * <dt>Heartbeat</dt> <dd>Provides {@link org.apache.tapestry5.services.Heartbeat}</dd>
+     * <dt>DefaultValidationDecorator</dt> <dd>Provides {@link org.apache.tapestry5.ValidationDecorator}
(as an instance
+     * of {@link org.apache.tapestry5.internal.DefaultValidationDecorator})</dd> </dl>
      */
     public void contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter>
configuration,
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/default.css
Sat Sep 27 12:04:03 2008
@@ -411,7 +411,7 @@
 
 /* The console is used to show debugging messages. */
 DIV.t-console {
-    position: absolute;
+    position: fixed;
     z-index: 1;
     top: 2px;
     left: 2px;
@@ -419,7 +419,6 @@
 
 DIV.t-console DIV {
     font-weight: bold;
-    cursor: pointer;
     padding: 0px 2px;
 }
 
@@ -436,4 +435,22 @@
 DIV.t-console DIV.t-debug {
     background-color: silver;
     color: black;
+}
+
+DIV.t-ajax-console {
+    font-weight: bold;
+    font-size: large;
+    cursor: pointer;
+    width: 100%;
+    text-align: center;
+    position: fixed;
+    z-index: 0;
+    left: 0px;
+    top: 0px;
+}
+
+DIV.t-ajax-console DIV.t-err {
+    background-color: red;
+    padding: 5px 2px 10px 2px;
+    color: yellow;
 }
\ No newline at end of file

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/tapestry.js
Sat Sep 27 12:04:03 2008
@@ -52,7 +52,7 @@
     DEBUG_ENABLED : false,
 
     /** Time, in seconds, that console messages are visible. */
-    CONSOLE_DURATION : 60,
+    CONSOLE_DURATION : 10,
 
     // Adds a callback function that will be invoked when the DOM is loaded (which
     // occurs *before* window.onload, which has to wait for images and such to load
@@ -196,19 +196,31 @@
             message = message.interpolate(substitutions);
 
         if (Tapestry.console == undefined)
-        {
-            var body = $$("BODY").first();
+            Tapestry.console = Tapestry.createConsole("t-console");
 
-            Tapestry.console = new Element("div", { 'class': "t-console" });
+        Tapestry.writeToConsole(Tapestry.console, className, message);
+    },
 
-            body.insert({ bottom: Tapestry.console });
-        }
+    createConsole : function(className)
+    {
+        var body = $$("BODY").first();
+
+        var console = new Element("div", { 'class': className });
+
+        body.insert({ top: console });
 
-        var div = new Element("div", { 'class': className }).update(message);
+        return console;
+    },
+
+    writeToConsole : function(console, className, message, slideDown)
+    {
+        var div = new Element("div", { 'class': className }).update(message).hide();
 
-        Tapestry.console.insert({ bottom: div });
+        console.insert({ top: div });
 
-        var effect = new Effect.BlindUp(div, { delay: Tapestry.CONSOLE_DURATION,
+        new Effect.Appear(div, { duration: .25 });
+
+        var effect = new Effect.Fade(div, { delay: Tapestry.CONSOLE_DURATION,
             afterFinish: function()
             {
                 div.remove();
@@ -219,7 +231,19 @@
             effect.cancel();
             div.remove();
         });
+    },
+
+    /** Adds a new entry to the Ajax console (which is never displayed using FireBug's console,
since
+     * we want to present the message clearly to the user).
+     * @param className of the new entry to the console, typically "t-err"
+     * @param message to display in the console
+     */
+    updateAjaxConsole : function (className, message)
+    {
+        if (Tapestry.ajaxConsole == undefined)
+            Tapestry.ajaxConsole = Tapestry.createConsole("t-ajax-console");
 
+        Tapestry.writeToConsole(Tapestry.ajaxConsole, className, message);
     },
 
     /**
@@ -243,9 +267,14 @@
     /**
      * Default function for handling Ajax-related failures.
      */
-    ajaxFailureHandler : function()
+    ajaxFailureHandler : function(response)
     {
-        Tapestry.error("Communication with the server failed.");
+        var message = response.getHeader("X-Tapestry-ErrorMessage");
+        "A communication error with the server has occurred.";
+
+        Tapestry.updateAjaxConsole("t-err", "Communication with the server failed: " + message);
+
+        Tapestry.debug("Ajax failure: Status #{status} for #{request.url}: " + message, response);
     },
 
     /**
@@ -258,7 +287,27 @@
      */
     ajaxRequest : function(url, successHandler)
     {
-        return new Ajax.Request(url, { onSuccess: successHandler, onFailure: Tapestry.ajaxFailureHandler
})
+        return new Ajax.Request(url, {
+            onSuccess: function(response, jsonResponse)
+            {
+                if (! response.request.success())
+                {
+                    Tapestry.updateAjaxConsole("t-err", "Server request was unsuccesful.
There may be a problem accessing the server.");
+                    return;
+                }
+
+                try
+                {
+                    // Re-invoke the success handler, capturing any exceptions.
+                    successHandler.call(this, response, jsonResponse);
+                }
+                catch (e)
+                {
+                    Tapestry.updateAjaxConsole("t-err", "Client exception processing response:
" + e);
+                }
+            },
+            onException: Tapestry.ajaxFailureHandler,
+            onFailure: Tapestry.ajaxFailureHandler })
     },
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/app1/nested/ZoneDemo.tml Sat Sep 27 12:04:03
2008
@@ -6,9 +6,11 @@
 
 
     <t:zone t:id="output" style="float:right; width: 800px;" update="slidedown">
-        <t:if test="name" else="No name has been selected.">
-            Selected: ${name}
-        </t:if>
+        <span class="t-zone-update">
+            <t:if test="name" else="No name has been selected.">
+                Selected: ${name}
+            </t:if>
+        </span>
     </t:zone>
 
     <t:block id="registrationForm">
@@ -55,6 +57,10 @@
         <li>
             <t:actionlink t:id="JSON" zone="output">Direct JSON response</t:actionlink>
         </li>
+        <li>
+            <t:actionlink t:id="fail" zone="output">Failure on the server side</t:actionlink>
+        </li>
+
     </ul>
 
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/IntegrationTests.java
Sat Sep 27 12:04:03 2008
@@ -32,7 +32,8 @@
  * Note: If these tests fail with BindException when starting Jetty, it could be Skype. At
least on my system, Skype is
  * listening on localhost:80.
  */
-@Test(timeOut = 50000, sequential = true, groups = {"integration"})
+@SuppressWarnings({"JavaDoc"})
+@Test(timeOut = 50000, sequential = true)
 public class IntegrationTests extends AbstractIntegrationTestSuite
 {
     public IntegrationTests()
@@ -1175,8 +1176,6 @@
     {
         start("DateField Demo", "clear", "english");
 
-        // TODO: Check to see if we need to explicitly set the locale for this test to work
properly.
-
         type("birthday", "24 dec 1966");
         type("asteroidImpact", "05/28/2046");
 
@@ -2020,6 +2019,7 @@
         }
         catch (InterruptedException ex)
         {
+            // Ignored.
         }
     }
 
@@ -2289,4 +2289,22 @@
                           "Render queue error in SetupRender[FormFieldOutsideForm:textfield]:
The Textfield component must be enclosed by a Form component.",
                           "context:FormFieldOutsideForm.tml, line 5, column 45");
     }
+
+    /**
+     * TAP5-240
+     */
+    public void ajax_server_side_exception()
+    {
+        start("Zone Demo");
+
+        click("link=Failure on the server side");
+
+        // Wait for the console to appear
+
+        waitForCondition("selenium.browserbot.getCurrentWindow().$$('DIV.t-ajax-console DIV.t-err').first()",
+                         PAGE_LOAD_TIMEOUT);
+
+        assertText("//DIV[@class='t-ajax-console']/DIV[@class='t-err']",
+                   "Communication with the server failed: Server-side exception.");
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java?rev=699719&r1=699718&r2=699719&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/ZoneDemo.java
Sat Sep 27 12:04:03 2008
@@ -76,6 +76,11 @@
         return output.getBody();
     }
 
+    void onActionFromFail()
+    {
+        throw new RuntimeException("Server-side exception.");
+    }
+
     Object onSuccessFromRegistrationForm()
     {
         return registrationOutput;



Mime
View raw message