Re: how to define a new asset domain
Hi Kalle, great idea, works great. Kind regards David On 11.05.2016 08:50, Kalle Korhonen wrote: In Tomcat, you'd just drop in a new context.xml and specify a docBase attribute in it (see http://stackoverflow.com/questions/1812244/simplest-way-to-serve-static-data-from-outside-the-application-server-in-a-java). Jetty had something similar, see their docs. Kalle On Tue, May 10, 2016 at 10:47 PM, D.R. wrote: Hi Kalle, sounds nice, how do i setup a new context and use it? Kind regards David On 11.05.2016 07:38, Kalle Korhonen wrote: If you are serving static files but want to keep the deployment simple, it's very straight forwarded to set up a new context, such as /images/ to purely serve static resources. I've done it in a few occasions and the nice thing about it is that you don't really need more than one liner in an xml file and you can configure the resource "webapplication" with very aggressive caching settings (at least Tomcat allows caching and serving everything from memory). Kalle On Tue, May 10, 2016 at 10:29 PM, D.R. wrote: Hi Jens, thanks for answer. No, not really what i want. I would like to write in my .tml which renders something like: and take a file from the filesystem by a defined path. I think for that the ExternalUrlAssetFactory is not doing what i want and i have to deal with my own impl of AssetFactory and Resource. In the meantime i found a solution from Lance which do similar what i want: http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem But i think more and more it is better to use an image server for that issue. Kind regards (also to Bobby) David On 10.05.2016 12:16, Jens Breitenstein wrote: Hi David! If I look at the classes implementing AssetFactory there is ExternalUrlAssetFactory, maybe this is what you want (file:///your-dir/your-asset.png)? AssetModule.java configures all context asset factories so you have to contribute configuration.add("file", new ExternalAssetFactory("file")) in your module, too. I have to admit, I did not test it, just browsing the T5.4 sources. Jens Am 10/05/16 um 08:53 schrieb D.R.: Hi @all, i need a new asset domain to have access to the filesystem. In the doc http://tapestry.apache.org/assets.html they say you "may define a new AssetFactory and contribute it to the AssetSource service configuration" I have no idea how to deal with the two methods. Please help. What i have to do in Order to get access to files on my filesystem? public AssetFactory buildAssetFactory() { return new AssetFactory(){ @Override public Asset createAsset(Resource arg0) { return null; } @Override public Resource getRootResource() { return null; } }; } Kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to define a new asset domain
In Tomcat, you'd just drop in a new context.xml and specify a docBase attribute in it (see http://stackoverflow.com/questions/1812244/simplest-way-to-serve-static-data-from-outside-the-application-server-in-a-java). Jetty had something similar, see their docs. Kalle On Tue, May 10, 2016 at 10:47 PM, D.R. wrote: > Hi Kalle, > > sounds nice, how do i setup a new context and use it? > > Kind regards > David > > > On 11.05.2016 07:38, Kalle Korhonen wrote: > >> If you are serving static files but want to keep the deployment simple, >> it's very straight forwarded to set up a new context, such as /images/ to >> purely serve static resources. I've done it in a few occasions and the >> nice >> thing about it is that you don't really need more than one liner in an xml >> file and you can configure the resource "webapplication" with very >> aggressive caching settings (at least Tomcat allows caching and serving >> everything from memory). >> >> Kalle >> >> On Tue, May 10, 2016 at 10:29 PM, D.R. wrote: >> >> Hi Jens, >>> >>> thanks for answer. No, not really what i want. >>> >>> I would like to write in my .tml >>> >>> >>> which renders something like: >>> >>> and take a file from the filesystem by a defined path. >>> >>> I think for that the ExternalUrlAssetFactory is not doing what i want and >>> i have to deal with my own impl of AssetFactory and Resource. >>> >>> In the meantime i found a solution from Lance which do similar what i >>> want: >>> >>> >>> http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem >>> >>> But i think more and more it is better to use an image server for that >>> issue. >>> >>> >>> Kind regards (also to Bobby) >>> David >>> >>> >>> On 10.05.2016 12:16, Jens Breitenstein wrote: >>> >>> Hi David! If I look at the classes implementing AssetFactory there is ExternalUrlAssetFactory, maybe this is what you want (file:///your-dir/your-asset.png)? AssetModule.java configures all context asset factories so you have to contribute configuration.add("file", new ExternalAssetFactory("file")) in your module, too. I have to admit, I did not test it, just browsing the T5.4 sources. Jens Am 10/05/16 um 08:53 schrieb D.R.: Hi @all, > > i need a new asset domain to have access to the filesystem. > > In the doc http://tapestry.apache.org/assets.html > they say you "may define a new AssetFactory and contribute it to the > AssetSource service configuration" > > I have no idea how to deal with the two methods. Please help. What i > have to do in Order to get access to files on my filesystem? > > public AssetFactory buildAssetFactory() > { > return new AssetFactory(){ > > @Override > public Asset createAsset(Resource arg0) > { > return null; > } > > @Override > public Resource getRootResource() { > return null; > } > > }; > } > > Kind regards > David > > > - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >>> >>> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: how to define a new asset domain
Hi Kalle, sounds nice, how do i setup a new context and use it? Kind regards David On 11.05.2016 07:38, Kalle Korhonen wrote: If you are serving static files but want to keep the deployment simple, it's very straight forwarded to set up a new context, such as /images/ to purely serve static resources. I've done it in a few occasions and the nice thing about it is that you don't really need more than one liner in an xml file and you can configure the resource "webapplication" with very aggressive caching settings (at least Tomcat allows caching and serving everything from memory). Kalle On Tue, May 10, 2016 at 10:29 PM, D.R. wrote: Hi Jens, thanks for answer. No, not really what i want. I would like to write in my .tml which renders something like: and take a file from the filesystem by a defined path. I think for that the ExternalUrlAssetFactory is not doing what i want and i have to deal with my own impl of AssetFactory and Resource. In the meantime i found a solution from Lance which do similar what i want: http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem But i think more and more it is better to use an image server for that issue. Kind regards (also to Bobby) David On 10.05.2016 12:16, Jens Breitenstein wrote: Hi David! If I look at the classes implementing AssetFactory there is ExternalUrlAssetFactory, maybe this is what you want (file:///your-dir/your-asset.png)? AssetModule.java configures all context asset factories so you have to contribute configuration.add("file", new ExternalAssetFactory("file")) in your module, too. I have to admit, I did not test it, just browsing the T5.4 sources. Jens Am 10/05/16 um 08:53 schrieb D.R.: Hi @all, i need a new asset domain to have access to the filesystem. In the doc http://tapestry.apache.org/assets.html they say you "may define a new AssetFactory and contribute it to the AssetSource service configuration" I have no idea how to deal with the two methods. Please help. What i have to do in Order to get access to files on my filesystem? public AssetFactory buildAssetFactory() { return new AssetFactory(){ @Override public Asset createAsset(Resource arg0) { return null; } @Override public Resource getRootResource() { return null; } }; } Kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to define a new asset domain
If you are serving static files but want to keep the deployment simple, it's very straight forwarded to set up a new context, such as /images/ to purely serve static resources. I've done it in a few occasions and the nice thing about it is that you don't really need more than one liner in an xml file and you can configure the resource "webapplication" with very aggressive caching settings (at least Tomcat allows caching and serving everything from memory). Kalle On Tue, May 10, 2016 at 10:29 PM, D.R. wrote: > Hi Jens, > > thanks for answer. No, not really what i want. > > I would like to write in my .tml > > > which renders something like: > > and take a file from the filesystem by a defined path. > > I think for that the ExternalUrlAssetFactory is not doing what i want and > i have to deal with my own impl of AssetFactory and Resource. > > In the meantime i found a solution from Lance which do similar what i want: > > http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem > > But i think more and more it is better to use an image server for that > issue. > > > Kind regards (also to Bobby) > David > > > On 10.05.2016 12:16, Jens Breitenstein wrote: > >> Hi David! >> >> If I look at the classes implementing AssetFactory there is >> ExternalUrlAssetFactory, maybe this is what you want >> (file:///your-dir/your-asset.png)? >> AssetModule.java configures all context asset factories so you have to >> contribute >> >> configuration.add("file", new ExternalAssetFactory("file")) >> >> in your module, too. I have to admit, I did not test it, just browsing >> the T5.4 sources. >> >> >> Jens >> >> >> Am 10/05/16 um 08:53 schrieb D.R.: >> >>> Hi @all, >>> >>> i need a new asset domain to have access to the filesystem. >>> >>> In the doc http://tapestry.apache.org/assets.html >>> they say you "may define a new AssetFactory and contribute it to the >>> AssetSource service configuration" >>> >>> I have no idea how to deal with the two methods. Please help. What i >>> have to do in Order to get access to files on my filesystem? >>> >>> public AssetFactory buildAssetFactory() >>> { >>> return new AssetFactory(){ >>> >>> @Override >>> public Asset createAsset(Resource arg0) >>> { >>> return null; >>> } >>> >>> @Override >>> public Resource getRootResource() { >>> return null; >>> } >>> >>> }; >>> } >>> >>> Kind regards >>> David >>> >>> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >
Re: how to define a new asset domain
Hi Jens, thanks for answer. No, not really what i want. I would like to write in my .tml which renders something like: and take a file from the filesystem by a defined path. I think for that the ExternalUrlAssetFactory is not doing what i want and i have to deal with my own impl of AssetFactory and Resource. In the meantime i found a solution from Lance which do similar what i want: http://stackoverflow.com/questions/30478306/tapestry-load-image-asset-from-filesystem But i think more and more it is better to use an image server for that issue. Kind regards (also to Bobby) David On 10.05.2016 12:16, Jens Breitenstein wrote: Hi David! If I look at the classes implementing AssetFactory there is ExternalUrlAssetFactory, maybe this is what you want (file:///your-dir/your-asset.png)? AssetModule.java configures all context asset factories so you have to contribute configuration.add("file", new ExternalAssetFactory("file")) in your module, too. I have to admit, I did not test it, just browsing the T5.4 sources. Jens Am 10/05/16 um 08:53 schrieb D.R.: Hi @all, i need a new asset domain to have access to the filesystem. In the doc http://tapestry.apache.org/assets.html they say you "may define a new AssetFactory and contribute it to the AssetSource service configuration" I have no idea how to deal with the two methods. Please help. What i have to do in Order to get access to files on my filesystem? public AssetFactory buildAssetFactory() { return new AssetFactory(){ @Override public Asset createAsset(Resource arg0) { return null; } @Override public Resource getRootResource() { return null; } }; } Kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: how to define a new asset domain
Hi David! If I look at the classes implementing AssetFactory there is ExternalUrlAssetFactory, maybe this is what you want (file:///your-dir/your-asset.png)? AssetModule.java configures all context asset factories so you have to contribute configuration.add("file", new ExternalAssetFactory("file")) in your module, too. I have to admit, I did not test it, just browsing the T5.4 sources. Jens Am 10/05/16 um 08:53 schrieb D.R.: Hi @all, i need a new asset domain to have access to the filesystem. In the doc http://tapestry.apache.org/assets.html they say you "may define a new AssetFactory and contribute it to the AssetSource service configuration" I have no idea how to deal with the two methods. Please help. What i have to do in Order to get access to files on my filesystem? public AssetFactory buildAssetFactory() { return new AssetFactory(){ @Override public Asset createAsset(Resource arg0) { return null; } @Override public Resource getRootResource() { return null; } }; } Kind regards David - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
how to define a new asset domain
Hi @all, i need a new asset domain to have access to the filesystem. In the doc http://tapestry.apache.org/assets.html they say you "may define a new AssetFactory and contribute it to the AssetSource service configuration" I have no idea how to deal with the two methods. Please help. What i have to do in Order to get access to files on my filesystem? public AssetFactory buildAssetFactory() { return new AssetFactory(){ @Override public Asset createAsset(Resource arg0) { return null; } @Override public Resource getRootResource() { return null; } }; } Kind regards David