org.apache.tapestry5.internal.services
Class AssetSourceImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.AssetSourceImpl
All Implemented Interfaces:
AssetSource

public class AssetSourceImpl
extends Object
implements AssetSource


Constructor Summary
AssetSourceImpl(ThreadLocale threadLocale, Map<String,AssetFactory> configuration)
           
 
Method Summary
 Asset getAsset(Resource baseResource, String path, Locale locale)
          Finds the asset.
 Asset getClasspathAsset(String path)
          Obtains a classpath alias in the current locale (as defined by the ThreadLocale service).
 Asset getClasspathAsset(String path, Locale locale)
          Convienience for finding assets on the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssetSourceImpl

public AssetSourceImpl(ThreadLocale threadLocale,
                       Map<String,AssetFactory> configuration)
Method Detail

getClasspathAsset

public Asset getClasspathAsset(String path)
Description copied from interface: AssetSource
Obtains a classpath alias in the current locale (as defined by the ThreadLocale service).

Specified by:
getClasspathAsset in interface AssetSource
Returns:
the asset

getClasspathAsset

public Asset getClasspathAsset(String path,
                               Locale locale)
Description copied from interface: AssetSource
Convienience for finding assets on the classpath.

Specified by:
getClasspathAsset in interface AssetSource
Parameters:
path - path to the base resource, relative to classpath root
locale - to localize the resource to
Returns:
the asset

getAsset

public Asset getAsset(Resource baseResource,
                      String path,
                      Locale locale)
Description copied from interface: AssetSource
Finds the asset. The path may either be a simple file name or a relative path (relative to the base resource) or it may have a prefix, such as "context:" or "classpath:", in which case it is treated as a complete path within the indicated domain. The resulting Resource is then localized (to the provided Locale) and returned as an Asset.

The AssetSource caches its results, so a single Asset instance may be shared among many different components.

Specified by:
getAsset in interface AssetSource
Parameters:
baseResource - base resource for computing relative paths, or null to search the classpath
path - relative to the base resource
locale - locale to localize the final resource to, or null for the thread's current locale
Returns:
the asset


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.