tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ta...@apache.org
Subject svn commit: r1211946 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/ main/java/org/apache/tapestry5/internal/services/ main/java/org/apache/tapestry5/internal/services/assets/ main/java/org/apache/tapestry5/services/ t...
Date Thu, 08 Dec 2011 16:18:31 GMT
Author: tawus
Date: Thu Dec  8 16:18:30 2011
New Revision: 1211946

URL: http://svn.apache.org/viewvc?rev=1211946&view=rev
Log:
TAP5-1756: Assets path can now be configured using tapestry.asset-path-prefix.

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestConstants.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AssetDispatcherTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ContextAssetFactoryTest.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/SymbolConstants.java
Thu Dec  8 16:18:30 2011
@@ -360,4 +360,9 @@ public class SymbolConstants
      * @since 5.3
      */
     public static final String ASSET_URL_FULL_QUALIFIED = "tapestry.asset-url-fully-qualified";
+
+    /**
+     * Prefix to be used for all asset paths
+     */
+    public static final String ASSET_PATH_PREFIX = "tapestry.asset-path-prefix";
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetDispatcher.java
Thu Dec  8 16:18:30 2011
@@ -59,11 +59,16 @@ public class AssetDispatcher implements 
                            @Symbol(SymbolConstants.APPLICATION_VERSION)
                            String applicationVersion,
 
-                           @Symbol(SymbolConstants.APPLICATION_FOLDER) String applicationFolder)
+                           @Symbol(SymbolConstants.APPLICATION_FOLDER)
+                           String applicationFolder,
+
+                           @Symbol(SymbolConstants.ASSET_PATH_PREFIX)
+                           String assetPathPrefix
+                           )
     {
         String folder = applicationFolder.equals("") ? "" : "/" + applicationFolder;
 
-        this.pathPrefix = folder + RequestConstants.ASSET_PATH_PREFIX + applicationVersion
+ "/";
+        this.pathPrefix = folder + assetPathPrefix + applicationVersion + "/";
 
         for (String path : configuration.keySet())
         {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestConstants.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestConstants.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/RequestConstants.java
Thu Dec  8 16:18:30 2011
@@ -26,14 +26,9 @@ public final class RequestConstants
 {
 
     /**
-     * Request path prefix that identifies an internal (on the classpath) asset.
-     */
-    public static final String ASSET_PATH_PREFIX = "/assets/";
-
-    /**
      * Virtual folder name for assets that are actually stored in the context, but are exposed
(much like classpath
      * assets) to gain far-future expires headers and automatic content compression.
-     * 
+     *
      * @since 5.1.0.0
      */
     public static final String CONTEXT_FOLDER = "ctx";
@@ -42,7 +37,7 @@ public final class RequestConstants
      * Folder for combined {@link JavaScriptStack} JavaScript files. The path consists of
the locale (as a folder) and
      * the name
      * of the stack (suffixed with ".js").
-     * 
+     *
      * @since 5.2.0
      */
     public static final String STACK_FOLDER = "stack";
@@ -50,14 +45,14 @@ public final class RequestConstants
     /**
      * Name of parameter, in an Ajax update, that identifies the client-side id of the {@link
Form} being extended. Used
      * with {@link Zone}, {@link FormInjector} and other similar components that may be contained
within a form.
-     * 
+     *
      * @since 5.2.0
      */
     public static final String FORM_CLIENTID_PARAMETER = "t:formid";
 
     /**
      * The server-side part of {@link #FORM_CLIENTID_PARAMETER} identifying the server-side
component id.
-     * 
+     *
      * @since 5.2.0
      */
     public static final String FORM_COMPONENTID_PARAMETER = "t:formcomponentid";

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/AssetPathConstructorImpl.java
Thu Dec  8 16:18:30 2011
@@ -15,7 +15,6 @@
 package org.apache.tapestry5.internal.services.assets;
 
 import org.apache.tapestry5.SymbolConstants;
-import org.apache.tapestry5.internal.services.RequestConstants;
 import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.services.BaseURLSource;
 import org.apache.tapestry5.services.Request;
@@ -41,7 +40,10 @@ public class AssetPathConstructorImpl im
                                     String applicationFolder,
 
                                     @Symbol(SymbolConstants.ASSET_URL_FULL_QUALIFIED)
-                                    boolean fullyQualified)
+                                    boolean fullyQualified,
+
+                                    @Symbol(SymbolConstants.ASSET_PATH_PREFIX)
+                                    String assetPathPrefix)
     {
         this.request = request;
         this.baseURLSource = baseURLSource;
@@ -50,7 +52,7 @@ public class AssetPathConstructorImpl im
 
         String folder = applicationFolder.equals("") ? "" : "/" + applicationFolder;
 
-        this.prefix = folder + RequestConstants.ASSET_PATH_PREFIX + applicationVersion +
"/";
+        this.prefix = folder + assetPathPrefix + applicationVersion + "/";
     }
 
     public String constructAssetPath(String virtualFolder, String path)

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=1211946&r1=1211945&r2=1211946&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
Thu Dec  8 16:18:30 2011
@@ -2259,6 +2259,8 @@ public final class TapestryModule
 
         configuration.add(SymbolConstants.CLUSTERED_SESSIONS, true);
 
+        configuration.add(SymbolConstants.ASSET_PATH_PREFIX, "/assets/");
+
         configuration.add(SymbolConstants.COMPRESS_WHITESPACE, true);
 
         configuration.add(MetaDataConstants.SECURE_PAGE, false);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/groovy/org/apache/tapestry5/integration/app3/PageCatalogTests.groovy
Thu Dec  8 16:18:30 2011
@@ -16,7 +16,7 @@ class PageCatalogTests extends TapestryC
 
         click "link=clear the cache"
 
-        sleep 500
+        sleep 1000
 
         assertTextPresent "Page cache cleared"
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AssetDispatcherTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AssetDispatcherTest.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AssetDispatcherTest.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/AssetDispatcherTest.java
Thu Dec  8 16:18:30 2011
@@ -34,6 +34,7 @@ public class AssetDispatcherTest extends
     private static final String SMILEY_PATH = "org/apache/tapestry5/integration/app1/pages/smiley.png";
 
     private static final Resource SMILEY = new ClasspathResource(SMILEY_PATH);
+
     private static final String APPLICATION_VERSION = "1.2.3";
 
 //    @Test
@@ -153,7 +154,7 @@ public class AssetDispatcherTest extends
 //        ResourceStreamer streamer = mockResourceStreamer();
 //        AssetResourceLocator locator = new AssetResourceLocatorImpl(aliasManager, cache,
APPLICATION_VERSION, null, response);
 //
-//        String clientURL = RequestConstants.ASSET_PATH_PREFIX + "app1/pages/smiley.RIGHT.png";
+//        String clientURL = "/assets/app1/pages/smiley.RIGHT.png";
 //        String resourcePath = "org/apache/tapestry5/integration/app1/pages/smiley.RIGHT.png";
 //
 //        train_getPath(request, clientURL);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetAliasManagerImplTest.java
Thu Dec  8 16:18:30 2011
@@ -86,10 +86,11 @@ public class ClasspathAssetAliasManagerI
 
         replay();
 
-        ClasspathAssetAliasManager manager = new ClasspathAssetAliasManagerImpl(new AssetPathConstructorImpl(request,
-                baseURLSource, APP_VERSION, "", false), configuration());
+        ClasspathAssetAliasManager manager = new ClasspathAssetAliasManagerImpl(
+                new AssetPathConstructorImpl(request,
+                baseURLSource, APP_VERSION, "", false, "/assets/"), configuration());
 
-        String expectedPath = "/ctx" + RequestConstants.ASSET_PATH_PREFIX + APP_VERSION +
"/" + expectedClientURL;
+        String expectedPath = "/ctx/assets/" + APP_VERSION + "/" + expectedClientURL;
         assertEquals(manager.toClientURL(resourcePath), expectedPath);
 
         verify();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ContextAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ContextAssetFactoryTest.java?rev=1211946&r1=1211945&r2=1211946&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ContextAssetFactoryTest.java
(original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ContextAssetFactoryTest.java
Thu Dec  8 16:18:30 2011
@@ -62,7 +62,8 @@ public class ContextAssetFactoryTest ext
                                                                 baseURLSource,
                                                                 "4.5.6",
                                                                 "",
-                                                                false
+                                                                false,
+                                                                "/assets/"
                                                             ),
                                     context,
                                     new IdentityAssetPathConverter()
@@ -101,7 +102,8 @@ public class ContextAssetFactoryTest ext
                                                                 baseURLSource,
                                                                 "4.5.6",
                                                                 "",
-                                                                true
+                                                                true,
+                                                                "/assets/"
                                                             ),
                                     context,
                                     new IdentityAssetPathConverter()



Mime
View raw message