myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r675109 - in /myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource: CoreClassLoaderResourceLoader.java CoreCommonScriptsResourceLoader.java
Date Wed, 09 Jul 2008 08:06:43 GMT
Author: matzew
Date: Wed Jul  9 01:06:43 2008
New Revision: 675109

URL: http://svn.apache.org/viewvc?rev=675109&view=rev
Log:
TRINIDAD-1149 - ApacheChart.js resource loading problems

Thanks to Andy Schwartz for this patch.
We now get a nice PERF. improvement on pages that don't contain the chart!

Modified:
    myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreClassLoaderResourceLoader.java
    myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java

Modified: myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreClassLoaderResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreClassLoaderResourceLoader.java?rev=675109&r1=675108&r2=675109&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreClassLoaderResourceLoader.java
(original)
+++ myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreClassLoaderResourceLoader.java
Wed Jul  9 01:06:43 2008
@@ -49,6 +49,7 @@
   protected URL findResource(
     String path) throws IOException
   {
+    // Strip the version string, since it is not present in the actual file name.
     String version = CoreRenderKitResourceLoader.__getVersion();
     int index = path.indexOf(version);
     if (index >= 0)
@@ -57,6 +58,38 @@
               path.substring(index + version.length()));
     }
 
+    // Fix up "jsLibs/Debug" -> "jsLibsDebug/".
+    path = _fixJavaScriptDebugPath(path);
+
     return super.findResource(path);
   }
+
+  // LibraryScriptlet prefixes debug JS libraries with the prefix
+  // "Debug".  So, for example,  the "Foo.js" library ends up being
+  // referred to via an URL of the form "<base>/jsLibs/DebugFoo.js".
+  // Unfortunately, this is out of sync with reality, since our
+  // JS libraries actually live under a "jsLibsDebug" directory,
+  // ie. the debug "Foo.js" lives at "META-INF/adf/jsLibsDebug/Foo.js".
+  // As a result, CoreClassLoaderResourceLoader fails to locate
+  // scripts that are rendered via a LibraryScriptlet.
+  //
+  // To work around this problem, this code converts paths of the
+  // form "jsLibs/Debug" to "jsLibsDebug/", which allows our
+  // library look ups to succeed.
+  //
+  // Note that an alternate approach might be to tweak LibraryScriptlet
+  // to generate the paths that CoreClassLoaderResourceLoader expects.
+  // One issue with this is that our "Common" and "LocaleInfo" libraries
+  // are handled somewhat differently, so any changes to LibraryScriptlet
+  // will impact at least those scripts as well.  Performing this mapping
+  // here seems the least intrusive.
+  private String _fixJavaScriptDebugPath(String path)
+  {
+    return (path.indexOf(_JS_DEBUG_PATH) >= 0) ?
+      path.replaceFirst(_JS_DEBUG_PATH, _FIXED_JS_DEBUG_PATH) :
+      path;
+  }
+
+  private static final String _JS_DEBUG_PATH = "jsLibs/Debug";
+  private static final String _FIXED_JS_DEBUG_PATH = "jsLibsDebug/";
 }

Modified: myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java?rev=675109&r1=675108&r2=675109&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java
(original)
+++ myfaces/trinidad/branches/1.2.8.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/CoreCommonScriptsResourceLoader.java
Wed Jul  9 01:06:43 2008
@@ -74,7 +74,6 @@
     "META-INF/adf/jsLibs/Shuttle.js",
     "META-INF/adf/jsLibs/PanelPopup.js",
     "META-INF/adf/jsLibs/PopupDialog.js",
-    "META-INF/adf/jsLibs/ApacheChart.js",
     "META-INF/adf/jsLibs/Page.js",
     "META-INF/adf/jsLibs/StatusIndicator.js",
     // XMMLHttp libraries
@@ -108,7 +107,6 @@
     "META-INF/adf/jsLibsDebug/Shuttle.js",
     "META-INF/adf/jsLibsDebug/PanelPopup.js",
     "META-INF/adf/jsLibsDebug/PopupDialog.js",
-    "META-INF/adf/jsLibsDebug/ApacheChart.js",
 
     "META-INF/adf/jsLibsDebug/Page.js",
     "META-INF/adf/jsLibsDebug/StatusIndicator.js",



Mime
View raw message