Package org.apache.tapestry5.services
Interface ClasspathAssetAliasManager
-
- All Known Implementing Classes:
ClasspathAssetAliasManagerImpl
@UsesMappedConfiguration(java.lang.String.class) public interface ClasspathAssetAliasManager
Deprecated.Deprecated in 5.4, with no replacement. This will no longer be used in Tapestry 5.5, as all classpath assets will need to be under theMETA-INF/assets
folder (but may be maintained for compatibility reasons until 5.6).Used as part of the support for classpathAsset
s, to convert the Asset'sResource
to a URL that can be accessed by the client. The asset path, within the classpath, is converted into a shorter virtual path. The term "alias" here is generally referred to as "virtual folder" elsewhere. Service configuration is a map from folder aliases (short names) to complete paths. Names should not start or end end with a slash. Generally, an alias should be a single name (not contain a slash). Paths should also not start or end with a slash. An example mapping would bemylib
tocom/example/mylib
. As originally envisioned, this service would simply optimize classpath assets, allowing the URL path for such assets to be shortened (and have a version number added, important for caching); thus the word "alias" makes sense ... it was responsible for creating an "alias" URL shorter than the default "classpath" URL. Starting in Tapestry 5.2, this changed; all classpath assets must be "aliased" to a shorter URL path. Any URL that can not be shortened is now rejected. This simplifies creating new libraries, but also helps with security concerns, as it limits which portions of the classpath can ever be exposed to the user agent. Tapestry automatically contributes a number of mappings: for the application root package itself (as alias "app") and for each library (viaComponentClassResolver.getFolderToPackageMapping()
);
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description AssetAlias
extractAssetAlias(Resource resource)
Deprecated.Takes a classpath resource and determines the proper alias for it based on the mappings contributed to the service.Map<String,String>
getMappings()
Deprecated.Returns the mappings used by the service: the keys are the folder aliases (i.e, "corelib") and the values are the corresponding paths (i.e., "org/apache/tapestry5/corelib").
-
-
-
Method Detail
-
extractAssetAlias
@IncompatibleChange(release="5.4", details="parameter changed from String to Resource, renamed from toClientURL() to better identify purpose") AssetAlias extractAssetAlias(Resource resource)
Deprecated.Takes a classpath resource and determines the proper alias for it based on the mappings contributed to the service.- Parameters:
resource
- classpath resource- Returns:
- URL ready to send to the client
-
getMappings
Map<String,String> getMappings()
Deprecated.Returns the mappings used by the service: the keys are the folder aliases (i.e, "corelib") and the values are the corresponding paths (i.e., "org/apache/tapestry5/corelib"). This exists primarily so thatClasspathAssetRequestHandler
s can be created automatically for each mapping.- Since:
- 5.2.0
-
-