Read about URL rewriting at https://tapestry.apache.org/url-rewriting.html, but 
cannot figure out how this can solve my question of how to access assets from 
javascript. 

> 
> I use to host tons of dealer websites on a single Tapestry application all
> with their own unique domain. I used a combination of Mod rewrite and
> Tapestry's URL rewriter. It worked flawlessly.
> 
> On Fri, Aug 7, 2015 at 8:00 AM, Svein-Erik Løken <[hidden email]> wrote:
> 
> > >
> > > > WOW! Multi-module in Tapestry with Live Class Reloading is fantastic!
> > > > Thanks for pointing me in the right direction Thiago!
> > >
> > > Yay! Virtual high-five! :D Tapestry is awesome, isn't it? ;)
> > >
> >
> > Oh yea! T5.4 is a success!
> >
> > > specify @SubModule(HappyModule.class) (or @ImportModule in T5.4) in
> your
> > Tanks Kalle! A good replacement for
> > <manifestEntries><Tapestry-Module-Classes>
> >
> >
> > I am moving a lot of code to my common module. I think the biggest
> > challenge is how to access assets from JavaScript.
> >
> > I moved the box_1.png, box_2.png, ... images to my common modules
> > META-INF.assets.jacillacore.img.destinationStatus
> >
> > public static void
> > contributeComponentClassResolver(Configuration<LibraryMapping>
> > configuration) {
> >         configuration.add(new LibraryMapping("jacillacore",
> > "com.jacilla.core"));
> > }
> >
> > My original code:
> > var iconUrl = "/img/destinationStatus/box_" + prepStatus + ".png";
> >
> > Tried:
> > var iconUrl = "${asset:jacillacore/img/destinationStatus/box_" +
> > prepStatus + ".png}";
> > and:
> > var iconUrl = "/jacillacore/assets/jacillacore/img/destinationStatus/box_"
> > + prepStatus + ".png";
> >
> >
> > It did not work! Is it possible to access then directly for javascript?
> >
> > To make it work I had to send the asset url's to the javascript module:
> >         final JSONObject statusImages = new JSONObject();
> >         for (int i = 1; i <= maxStatus; i++) {
> >             final String format =
> > String.format("/META-
> INF/assets/jacillacore/img/destinationStatus/box_%d.png",
> > i);
> >             Asset asset = assetSource.getExpandedAsset(format);
> >             statusImages.put(String.valueOf(i), asset.toClientURL());
> >         }
> >         return new JSONObject(
> >                 "statusImages", statusImages,
> >                 "symbols", symbols);
> >
> > Is this the correct way of doing this in T5.4, or could it be simpler?
> >

Reply via email to