I am trying to create my own AssetFactory to read assets from a filesystem,
but I'm getting an exception.

My AppModule ~has the following:

public AssetFactory buildMyAssetFactory(@InjectService("ResourceCache")
           ResourceCache resourceCache) {
       return new MyAssetFactory(resourceCache);
   }

   public void contributeAssetSource(MappedConfiguration<String,
AssetFactory> configuration,
           @InjectService("MyAssetFactory") AssetFactory myAssetFactory)
   {
       configuration.add("myassets", myAssetFactory);
   }

My page has:
@Inject("myassets:path to file")
private Asset _myFile;

public Asset getMyFile() { return _myFile; }


The factory is currently a clone of the ClasspathAssetFactory (while I
figure things out), except the path it returns is prefixed with
"fromMyAssets" for testing purposes.

The exception I get when I try to load the page is :

java.lang.RuntimeException
Unable to locate asset 'classpath:path to file' (the file does not exist).

Stack trace

       *
org.apache.tapestry.internal.services.AssetSourceImpl.findRelativeAsset(
AssetSourceImpl.java:101)
       * org.apache.tapestry.internal.services.AssetSourceImpl.findAsset(
AssetSourceImpl.java:92)
       * component <init> ...

I am not sure why it reads classpath:path to file instead of myassets:path
to file or what approach I should take to solve this issue. Any help is
appreciated :-)
--
Peter Beshai

Computer Science Student
University of Waterloo

Reply via email to