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

[1/3] tapestry-5 git commit: A little whitespace tweak

Repository: tapestry-5
Updated Branches:
  refs/heads/master faaf0b025 -> cf5858fbb


A little whitespace tweak

Somehow, not committed with the rest


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/009a6ae4
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/009a6ae4
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/009a6ae4

Branch: refs/heads/master
Commit: 009a6ae47c429fbb11729cf452a2f7413b828f65
Parents: faaf0b0
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Apr 6 16:52:59 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Apr 6 16:52:59 2015 -0700

----------------------------------------------------------------------
 .../src/main/resources/components/Layout.tml              | 10 +++++-----
 .../src/main/resources/pages/Index.tml                    |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/009a6ae4/quickstart/filtered/archetype-resources/src/main/resources/components/Layout.tml
----------------------------------------------------------------------
diff --git a/quickstart/filtered/archetype-resources/src/main/resources/components/Layout.tml b/quickstart/filtered/archetype-resources/src/main/resources/components/Layout.tml
index 6e3523b..cdd27ff 100644
--- a/quickstart/filtered/archetype-resources/src/main/resources/components/Layout.tml
+++ b/quickstart/filtered/archetype-resources/src/main/resources/components/Layout.tml
@@ -3,13 +3,13 @@
       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
         >
 <head>
-    <meta charset="utf-8" />
+    <meta charset="utf-8"/>
     <title>${D}{title}</title>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="description" content="" />
-    <meta name="author" content="" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+    <meta name="description" content=""/>
+    <meta name="author" content=""/>
     <!-- Fav and touch icons -->
-    <link rel="shortcut icon" href="${D}{asset:context:/favicon.ico}" />
+    <link rel="shortcut icon" href="${D}{asset:context:/favicon.ico}"/>
 </head>
 
 <body>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/009a6ae4/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml
----------------------------------------------------------------------
diff --git a/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml b/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml
index ca21cfb..c670fcd 100644
--- a/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml
+++ b/quickstart/filtered/archetype-resources/src/main/resources/pages/Index.tml
@@ -1,6 +1,6 @@
 <html t:type="layout" title="${artifactId} Index"
       xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
-      xmlns:p="tapestry:parameter">
+        >
 
     <!-- Most of the page content, including <head>, <body>, etc. tags, comes from Layout.tml -->
 
@@ -8,7 +8,7 @@
     <div class="hero-unit">
         <p>
             <img src="${D}{asset:context:images/tapestry.png}"
-                 alt="${D}{message:greeting}" title="${D}{message:greeting}" />
+                 alt="${D}{message:greeting}" title="${D}{message:greeting}"/>
         </p>
         <h3>${D}{message:greeting}</h3>
         <p>The current time is: <strong>${D}{currentTime}</strong></p>


[2/3] tapestry-5 git commit: Rework how the action link on the ExceptionReport page are constructed

Posted by hl...@apache.org.
Rework how the action link on the ExceptionReport page are constructed

Previously, the approach was very susceptible to further exceptions while generating the page activation context for the failed page.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7d9b1bb2
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7d9b1bb2
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7d9b1bb2

Branch: refs/heads/master
Commit: 7d9b1bb21e478ee58e0b1793856ba5a05dab9561
Parents: 009a6ae
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Apr 6 16:53:51 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Apr 6 16:53:51 2015 -0700

----------------------------------------------------------------------
 .../corelib/pages/ExceptionReport.java          | 85 ++++++++++++++++++--
 .../tapestry5/corelib/pages/ExceptionReport.tml | 28 ++-----
 2 files changed, 83 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7d9b1bb2/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
index 248b347..06208e0 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
@@ -12,7 +12,9 @@
 
 package org.apache.tapestry5.corelib.pages;
 
+import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.Link;
 import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.alerts.AlertManager;
 import org.apache.tapestry5.annotations.ContentType;
@@ -78,9 +80,6 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     @Property
     private String propertyName;
 
-    @Property
-    private String failurePage;
-
     @Inject
     private RequestGlobals requestGlobals;
 
@@ -108,6 +107,29 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     @Property
     private ThreadInfo thread;
 
+    @Inject
+    private ComponentResources resources;
+
+    private String failurePage;
+
+    /**
+     * A link the user may press to perform an action (e.g., "Reload page").
+     */
+    public static class ActionLink
+    {
+        public final String uri, label;
+
+
+        public ActionLink(String uri, String label)
+        {
+            this.uri = uri;
+            this.label = label;
+        }
+    }
+
+    @Property
+    private ActionLink actionLink;
+
     public class ThreadInfo implements Comparable<ThreadInfo>
     {
         public final String className, name, state, flags;
@@ -153,26 +175,73 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     {
         rootException = exception;
 
+        rootURL = baseURLSource.getBaseURL(request.isSecure());
+
+        // Capture this now ... before the gears are shifted around to make ExceptionReport the active page.
         failurePage = (request.getAttribute(InternalConstants.ACTIVE_PAGE_LOADED) == null)
                 ? null
                 : requestGlobals.getActivePageName();
+    }
 
-        rootURL = baseURLSource.getBaseURL(request.isSecure());
+    private static void add(List<ActionLink> links, Link link, String format, Object... arguments)
+    {
+        String label = String.format(format, arguments);
+        links.add(new ActionLink(link.toURI(), label));
     }
 
-    public Object[] getReloadContext()
+    public List<ActionLink> getActionLinks()
     {
-        return pageActivationContextCollector.collectPageActivationContext(failurePage);
+        List<ActionLink> links = CollectionFactory.newList();
+
+        if (failurePage != null)
+        {
+
+            try
+            {
+
+                Object[] pac = pageActivationContextCollector.collectPageActivationContext(failurePage);
+
+                add(links,
+                        linkSource.createPageRenderLinkWithContext(failurePage, pac),
+                        "Go to page <strong>%s</strong>", failurePage);
+
+                if (! productionMode)
+                {
+                    add(links,
+                            resources.createEventLink("reloadFirst", pac).addParameter("loadPage", failurePage),
+                            "Go to page <strong>%s</strong> (with reload)", failurePage);
+                }
+
+            } catch (Throwable t)
+            {
+                // Ignore.
+            }
+
+            links.add(new ActionLink(rootURL,
+                    String.format("Go to <strong>%s</strong>", rootURL)));
+
+
+            if (! productionMode) {
+                add(links,
+                        resources.createEventLink("reloadFirst"),
+                        "Go to <strong>%s</strong> (with reload)", rootURL);
+
+            }
+        }
+
+        return links;
     }
 
-    Object onActionFromReloadFirst(EventContext reloadContext)
+
+
+    Object onReloadFirst(EventContext reloadContext)
     {
         reloadHelper.forceReload();
 
         return linkSource.createPageRenderLinkWithContext(urlEncoder.decode(request.getParameter("loadPage")), reloadContext);
     }
 
-    Object onActionFromReloadRoot() throws MalformedURLException
+    Object onReloadRoot() throws MalformedURLException
     {
         reloadHelper.forceReload();
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7d9b1bb2/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
index 74cdc1e..25a031c 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
@@ -41,28 +41,12 @@
                     <div class="panel-footer">
 
                         <div class="btn-toolbar btn-group-xs">
-                            <t:if test="failurePage">
-                                <t:pagelink page="prop:failurePage" class="btn btn-default">Go to page
-                                    <strong>${failurePage}</strong>
-                                </t:pagelink>
-                                <t:if test="showReload">
-                                    <t:actionlink t:id="reloadFirst" parameters="{'loadPage': failurePage}"
-                                                  context="reloadContext" class="btn btn-default">Go to page
-                                        <strong>${failurePage}</strong>
-                                        (with reload)
-                                    </t:actionlink>
-                                </t:if>
-                            </t:if>
-                            <a href="/" class="btn btn-default">Go to
-                                <strong>${rootURL}</strong>
-                            </a>
-                            <t:if test="showReload">
-                                <t:actionLink t:id="reloadRoot" class="btn btn-default">
-                                    Go to
-                                    <strong>${rootURL}</strong>
-                                    (with reload)
-                                </t:actionLink>
-                            </t:if>
+                            <t:loop source="actionLinks" value="actionLink">
+                                <a href="${actionLink.uri}" class="btn btn-default">
+                                    <t:outputRaw value="actionLink.label"/>
+                                </a>
+                            </t:loop>
+
                         </div>
                     </div>
                     <t:if test="showReload">


[3/3] tapestry-5 git commit: Advance version to 5.4-beta-31

Posted by hl...@apache.org.
Advance version to 5.4-beta-31


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cf5858fb
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cf5858fb
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cf5858fb

Branch: refs/heads/master
Commit: cf5858fbb4bf1b516c5c08e6df18f5b2eb7d6d8f
Parents: 7d9b1bb
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Apr 7 13:22:49 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Apr 7 13:22:49 2015 -0700

----------------------------------------------------------------------
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf5858fb/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 10f944a..63e805d 100755
--- a/build.gradle
+++ b/build.gradle
@@ -34,7 +34,7 @@ project.version = tapestryVersion()
 def tapestryVersion() {
 
     def major = "5.4"
-    def minor = "-beta-30"
+    def minor = "-beta-31"
 
     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
     // When building normally, or for a release, no suffix is desired.


[2/3] tapestry-5 git commit: Rework how the action link on the ExceptionReport page are constructed

Posted by hl...@apache.org.
Rework how the action link on the ExceptionReport page are constructed

Previously, the approach was very susceptible to further exceptions while generating the page activation context for the failed page.


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/7d9b1bb2
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/7d9b1bb2
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/7d9b1bb2

Branch: refs/heads/master
Commit: 7d9b1bb21e478ee58e0b1793856ba5a05dab9561
Parents: 009a6ae
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Mon Apr 6 16:53:51 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Mon Apr 6 16:53:51 2015 -0700

----------------------------------------------------------------------
 .../corelib/pages/ExceptionReport.java          | 85 ++++++++++++++++++--
 .../tapestry5/corelib/pages/ExceptionReport.tml | 28 ++-----
 2 files changed, 83 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7d9b1bb2/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
index 248b347..06208e0 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/ExceptionReport.java
@@ -12,7 +12,9 @@
 
 package org.apache.tapestry5.corelib.pages;
 
+import org.apache.tapestry5.ComponentResources;
 import org.apache.tapestry5.EventContext;
+import org.apache.tapestry5.Link;
 import org.apache.tapestry5.SymbolConstants;
 import org.apache.tapestry5.alerts.AlertManager;
 import org.apache.tapestry5.annotations.ContentType;
@@ -78,9 +80,6 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     @Property
     private String propertyName;
 
-    @Property
-    private String failurePage;
-
     @Inject
     private RequestGlobals requestGlobals;
 
@@ -108,6 +107,29 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     @Property
     private ThreadInfo thread;
 
+    @Inject
+    private ComponentResources resources;
+
+    private String failurePage;
+
+    /**
+     * A link the user may press to perform an action (e.g., "Reload page").
+     */
+    public static class ActionLink
+    {
+        public final String uri, label;
+
+
+        public ActionLink(String uri, String label)
+        {
+            this.uri = uri;
+            this.label = label;
+        }
+    }
+
+    @Property
+    private ActionLink actionLink;
+
     public class ThreadInfo implements Comparable<ThreadInfo>
     {
         public final String className, name, state, flags;
@@ -153,26 +175,73 @@ public class ExceptionReport extends AbstractInternalPage implements ExceptionRe
     {
         rootException = exception;
 
+        rootURL = baseURLSource.getBaseURL(request.isSecure());
+
+        // Capture this now ... before the gears are shifted around to make ExceptionReport the active page.
         failurePage = (request.getAttribute(InternalConstants.ACTIVE_PAGE_LOADED) == null)
                 ? null
                 : requestGlobals.getActivePageName();
+    }
 
-        rootURL = baseURLSource.getBaseURL(request.isSecure());
+    private static void add(List<ActionLink> links, Link link, String format, Object... arguments)
+    {
+        String label = String.format(format, arguments);
+        links.add(new ActionLink(link.toURI(), label));
     }
 
-    public Object[] getReloadContext()
+    public List<ActionLink> getActionLinks()
     {
-        return pageActivationContextCollector.collectPageActivationContext(failurePage);
+        List<ActionLink> links = CollectionFactory.newList();
+
+        if (failurePage != null)
+        {
+
+            try
+            {
+
+                Object[] pac = pageActivationContextCollector.collectPageActivationContext(failurePage);
+
+                add(links,
+                        linkSource.createPageRenderLinkWithContext(failurePage, pac),
+                        "Go to page <strong>%s</strong>", failurePage);
+
+                if (! productionMode)
+                {
+                    add(links,
+                            resources.createEventLink("reloadFirst", pac).addParameter("loadPage", failurePage),
+                            "Go to page <strong>%s</strong> (with reload)", failurePage);
+                }
+
+            } catch (Throwable t)
+            {
+                // Ignore.
+            }
+
+            links.add(new ActionLink(rootURL,
+                    String.format("Go to <strong>%s</strong>", rootURL)));
+
+
+            if (! productionMode) {
+                add(links,
+                        resources.createEventLink("reloadFirst"),
+                        "Go to <strong>%s</strong> (with reload)", rootURL);
+
+            }
+        }
+
+        return links;
     }
 
-    Object onActionFromReloadFirst(EventContext reloadContext)
+
+
+    Object onReloadFirst(EventContext reloadContext)
     {
         reloadHelper.forceReload();
 
         return linkSource.createPageRenderLinkWithContext(urlEncoder.decode(request.getParameter("loadPage")), reloadContext);
     }
 
-    Object onActionFromReloadRoot() throws MalformedURLException
+    Object onReloadRoot() throws MalformedURLException
     {
         reloadHelper.forceReload();
 

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/7d9b1bb2/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
index 74cdc1e..25a031c 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/ExceptionReport.tml
@@ -41,28 +41,12 @@
                     <div class="panel-footer">
 
                         <div class="btn-toolbar btn-group-xs">
-                            <t:if test="failurePage">
-                                <t:pagelink page="prop:failurePage" class="btn btn-default">Go to page
-                                    <strong>${failurePage}</strong>
-                                </t:pagelink>
-                                <t:if test="showReload">
-                                    <t:actionlink t:id="reloadFirst" parameters="{'loadPage': failurePage}"
-                                                  context="reloadContext" class="btn btn-default">Go to page
-                                        <strong>${failurePage}</strong>
-                                        (with reload)
-                                    </t:actionlink>
-                                </t:if>
-                            </t:if>
-                            <a href="/" class="btn btn-default">Go to
-                                <strong>${rootURL}</strong>
-                            </a>
-                            <t:if test="showReload">
-                                <t:actionLink t:id="reloadRoot" class="btn btn-default">
-                                    Go to
-                                    <strong>${rootURL}</strong>
-                                    (with reload)
-                                </t:actionLink>
-                            </t:if>
+                            <t:loop source="actionLinks" value="actionLink">
+                                <a href="${actionLink.uri}" class="btn btn-default">
+                                    <t:outputRaw value="actionLink.label"/>
+                                </a>
+                            </t:loop>
+
                         </div>
                     </div>
                     <t:if test="showReload">


[3/3] tapestry-5 git commit: Advance version to 5.4-beta-31

Posted by hl...@apache.org.
Advance version to 5.4-beta-31


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/cf5858fb
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/cf5858fb
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/cf5858fb

Branch: refs/heads/master
Commit: cf5858fbb4bf1b516c5c08e6df18f5b2eb7d6d8f
Parents: 7d9b1bb
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Apr 7 13:22:49 2015 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Apr 7 13:22:49 2015 -0700

----------------------------------------------------------------------
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/cf5858fb/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 10f944a..63e805d 100755
--- a/build.gradle
+++ b/build.gradle
@@ -34,7 +34,7 @@ project.version = tapestryVersion()
 def tapestryVersion() {
 
     def major = "5.4"
-    def minor = "-beta-30"
+    def minor = "-beta-31"
 
     // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build.
     // When building normally, or for a release, no suffix is desired.