Hi all,

I am trying to write an file system asset. Before I get to the problem, does
anyone has any idea why that is not included? It seems to me that this is
not something that the users should write for them selves, right? If someone
has a better approach or a solution to my problem please let me know?

After looking online I have found an old bug jira in tapestry with possible
solution 

https://issues.apache.org/jira/browse/TAP5-423

I have taken that solution and reimplemented it, removed some more complex
thing that I dont need (this was first imagined as tapestry patch so it
modifies some core classes so I have write it without that). The java files
can be found below. 

http://tapestry.1045711.n5.nabble.com/file/n5641308/AssetPathPrefixAliasMap.java
AssetPathPrefixAliasMap.java 
http://tapestry.1045711.n5.nabble.com/file/n5641308/FileAssetAliasManager.java
FileAssetAliasManager.java 
http://tapestry.1045711.n5.nabble.com/file/n5641308/FileAssetAliasManagerImpl.java
FileAssetAliasManagerImpl.java 
http://tapestry.1045711.n5.nabble.com/file/n5641308/FileAssetFactory.java
FileAssetFactory.java 
http://tapestry.1045711.n5.nabble.com/file/n5641308/FileBindingFactory.java
FileBindingFactory.java 
http://tapestry.1045711.n5.nabble.com/file/n5641308/FileResource.java
FileResource.java 

AppModule.java

    public static void bind(ServiceBinder binder) {
        binder.bind(FileAssetAliasManager.class,
FileAssetAliasManagerImpl.class);
        binder.bind(FileAssetFactory.class);
        binder.bind(BindingFactory.class,
FileBindingFactory.class).withId("FileBindingFactory");
    }

 public static void
contributeFileAssetAliasManager(MappedConfiguration<String, String>
configuration) {
        configuration.add("images",
"file:/C:/Users/borish/Documents/NetBeansProjects/flow/src/main/webapp/images/");
    }

    public void contributeAssetSource(MappedConfiguration<String,
AssetFactory> configuration,
            FileAssetFactory filesystemAssetFactory) {
        configuration.add("file", filesystemAssetFactory);
    }

    public static void contributeBindingSource(MappedConfiguration<String,
BindingFactory> configuration,
            @InjectService("FileBindingFactory") BindingFactory
fileBindingFactory) {
        configuration.add("file", fileBindingFactory);
    }

Usage example

  ${file:images/logo.png} 

So this works in a way that it compiles and I can run the application. The
file path is written ok, and I can see in that paths is converted as it
should be. However in the browser I get an error that says 

Resource interpreted as Image but transferred with MIME type text/html

I am now quite sure why is this happening? Any ideas? 

I am hoping that a lot of users will get onto this as I think that it should
be part of tapestry :D
Also how can someone become a contributor to the tapestry?

--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/File-System-Asset-Factory-help-needed-and-petition-wanted-tp5641308p5641308.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to