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 2010/04/19 16:08:06 UTC

svn commit: r935584 - in /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5: internal/services/ internal/services/assets/ services/assets/

Author: hlship
Date: Mon Apr 19 14:08:06 2010
New Revision: 935584

URL: http://svn.apache.org/viewvc?rev=935584&view=rev
Log:
Remove some now-unused methods

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocator.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocatorImpl.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/assets/AssetPathConstructor.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocator.java?rev=935584&r1=935583&r2=935584&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocator.java Mon Apr 19 14:08:06 2010
@@ -14,11 +14,10 @@
 
 package org.apache.tapestry5.internal.services;
 
-import org.apache.tapestry5.ioc.Resource;
-import org.apache.tapestry5.services.assets.AssetPathConstructor;
-
 import java.io.IOException;
 
+import org.apache.tapestry5.ioc.Resource;
+
 /**
  * Responsible for converting a path into a {@link org.apache.tapestry5.ioc.Resource} that can be
  * {@linkplain org.apache.tapestry5.internal.services.ResourceStreamer
@@ -30,19 +29,6 @@ import java.io.IOException;
 public interface AssetResourceLocator
 {
     /**
-     * Analyzes the path and identifies the underlying Asset Resource for that path. Handles both context resources and
-     * classpath resources,
-     * as well as checking for a digest (for protected classpath resources).
-     * 
-     * @param path
-     *            path for Asset URL, as per {@link AssetPathConstructor#constructAssetPath(String, String)}
-     * @return
-     *         resource corresponding to path (may be for a non-existent resource), or null if path is invalid (i.e.,
-     *         incorrect digest)
-     */
-    Resource findResourceForAssetPath(String path) throws IOException;
-
-    /**
      * For a complete classpath path, returns the Resource for the path. This include checking for a
      * digest for protected files.
      * 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocatorImpl.java?rev=935584&r1=935583&r2=935584&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocatorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/AssetResourceLocatorImpl.java Mon Apr 19 14:08:06 2010
@@ -15,16 +15,12 @@
 package org.apache.tapestry5.internal.services;
 
 import java.io.IOException;
-import java.util.Map;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.tapestry5.internal.AssetConstants;
 import org.apache.tapestry5.ioc.Resource;
 import org.apache.tapestry5.services.AssetSource;
-import org.apache.tapestry5.services.ClasspathAssetAliasManager;
 import org.apache.tapestry5.services.Response;
-import org.apache.tapestry5.services.assets.AssetPathConstructor;
 
 public class AssetResourceLocatorImpl implements AssetResourceLocator
 {
@@ -34,63 +30,15 @@ public class AssetResourceLocatorImpl im
 
     private final AssetSource assetSource;
 
-    private final String contextAssetPathPrefix;
-
-    private final String assetPathPrefix;
-    
-    private final Map<String, String> classpathMappings;
-
-    public AssetResourceLocatorImpl(ResourceCache resourceCache,
-
-    Response response,
-
-    AssetSource assetSource, ClasspathAssetAliasManager aliasManager,
-
-    AssetPathConstructor assetPathConstructor)
+    public AssetResourceLocatorImpl(ResourceCache resourceCache, Response response, AssetSource assetSource)
     {
         this.resourceCache = resourceCache;
         this.response = response;
         this.assetSource = assetSource;
-
-        classpathMappings = aliasManager.getMappings();
-
-        contextAssetPathPrefix = assetPathConstructor.constructAssetPath(RequestConstants.CONTEXT_FOLDER, "");
-        
-        assetPathPrefix = assetPathConstructor.getAssetPathPrefix();
-        
-    }
-
-    public Resource findResourceForAssetPath(String path) throws IOException
-    {
-        if (path.startsWith(contextAssetPathPrefix))
-        {
-            String assetPath = String.format("%s:%s", AssetConstants.CONTEXT, path.substring(contextAssetPathPrefix
-                    .length() + 1));
-
-            return assetSource.resourceForPath(assetPath);
-        }
-
-        // TODO: We need some work in this area to support more than just classpath and context assets
-        // but any asset.
-
-        // The path provided has been mangled into an asset URL for a classpath asset. Let's unmangle it.
-
-        // Strip off the asset path prefix, leaving just the virtual folder and path below it.
-        
-        String virtualPath = path.substring(assetPathPrefix.length());
-        
-        int slashx = virtualPath.indexOf('/');
-        String virtualFolder = virtualPath.substring(0, slashx);
-        String extraPath = virtualPath.substring(slashx + 1);
-
-        String assetPath = classpathMappings.get(virtualFolder) + "/" + extraPath;
-
-        return findClasspathResourceForPath(assetPath);
     }
 
     public Resource findClasspathResourceForPath(String path) throws IOException
     {
-
         Resource resource = assetSource.resourceForPath(path);
 
         if (!resourceCache.requiresDigest(resource))
@@ -121,7 +69,6 @@ public class AssetResourceLocatorImpl im
 
             if (prevdotx > 0)
             {
-
                 String requestDigest = file.substring(prevdotx + 1, lastdotx);
 
                 // Strip the digest out of the file name.

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=935584&r1=935583&r2=935584&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 Mon Apr 19 14:08:06 2010
@@ -37,11 +37,6 @@ public class AssetPathConstructorImpl im
         this.prefix = RequestConstants.ASSET_PATH_PREFIX + applicationVersion + "/";
     }
 
-    public String getAssetPathPrefix()
-    {
-        return request.getContextPath() + prefix;
-    }
-
     public String constructAssetPath(String virtualFolder, String path)
     {
         StringBuilder builder = new StringBuilder(request.getContextPath());

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetPathConstructor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetPathConstructor.java?rev=935584&r1=935583&r2=935584&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetPathConstructor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/assets/AssetPathConstructor.java Mon Apr 19 14:08:06 2010
@@ -34,10 +34,4 @@ public interface AssetPathConstructor
      *         the virtual folder, and the path extension
      */
     String constructAssetPath(String virtualFolder, String path);
-
-    /**
-     * Returns the prefix portion of the asset URL, the portion including the context path, the /assets/ virtual folder,
-     * and the version number, and the trailing slash.
-     */
-    String getAssetPathPrefix();
 }