You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2014/06/30 20:46:56 UTC

git commit: TAP5-1515 : Support for external assets (some code improvements)

Repository: tapestry-5
Updated Branches:
  refs/heads/master d150c3c73 -> d9a795f1a


TAP5-1515 : Support for external assets (some code improvements)

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

Branch: refs/heads/master
Commit: d9a795f1a90e4994a1b64658caf94ba58e9da623
Parents: d150c3c
Author: Thiago H. de Paula Figueiredo <th...@apache.org>
Authored: Mon Jun 30 15:46:46 2014 -0300
Committer: Thiago H. de Paula Figueiredo <th...@apache.org>
Committed: Mon Jun 30 15:46:46 2014 -0300

----------------------------------------------------------------------
 .../internal/services/AssetSourceImpl.java        |  3 ++-
 .../integration/app1/pages/nested/AssetDemo.java  |  2 +-
 .../integration/app1/pages/nested/AssetDemo.tml   | 18 ------------------
 3 files changed, 3 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9a795f1/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
index bac9e0c..140b32b 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetSourceImpl.java
@@ -173,7 +173,8 @@ public class AssetSourceImpl extends LockSupport implements AssetSource
                                 String url;
                                 if (prefix.equals(AssetConstants.PROTOCOL_RELATIVE)) 
                                 {
-                                    url = (request != null && request.isSecure() ? "https:" : "http:") + expanded;  
+                                    url = (request != null && request.isSecure() ? "https:" : "http:") + expanded;
+                                    url = url.replace("//:", "//");
                                 }
                                 else
                                 {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9a795f1/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.java
index 57a049f..ca77f76 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.java
@@ -28,7 +28,7 @@ import org.apache.tapestry5.services.javascript.StylesheetOptions;
  * Primarily used to demonstrate that assets can be localized and exposed to the client, this has grown to also
  * demonstrate the use of the {@link Import} annotation.
  */
-@Import(library = {"http://${d3.url}", "AssetDemo.js"})
+@Import(library = {"//:${d3.url}", "AssetDemo.js"})
 public class AssetDemo
 {
     @Property

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d9a795f1/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.tml
index 6a4f8e7..68bc425 100644
--- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.tml
+++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/nested/AssetDemo.tml
@@ -83,24 +83,6 @@
 	Using d3, loaded directly from a CDN using external asset support (example from http://christopheviau.com/d3_tutorial/): 
 </p>
 
-<script type="text/javascript">
-
-    var sampleSVG = d3.select("#viz")
-        .append("svg")
-        .attr("width", 100)
-        .attr("height", 100);    
-
-    sampleSVG.append("circle")
-        .style("stroke", "gray")
-        .style("fill", "white")
-        .attr("r", 40)
-        .attr("cx", 50)
-        .attr("cy", 50)
-        .on("mouseover", function(){d3.select(this).style("fill", "aliceblue");})
-        .on("mouseout", function(){d3.select(this).style("fill", "white");});
-    
-</script>
-
 <div id="viz"/>
 
 </html>
\ No newline at end of file