Extend ResourceRefrence class and do the aliasing in its constructor.
There you have all the needed information - class and resource name.

Then in MyComponent.java:
...
Image image = new Image("image", new AutoAliasResourceReference(...)); 


On Sat, 2010-03-13 at 10:47 +0100, Thomas Götz wrote:
> Well ok, this is helpful. But: what do you do if you have a lot of embedded 
> resources referenced from a lot of different components? Do I have to put an 
> alias for every single class? This is quite verbose, isn't there an easier 
> way to e.g. set an alias for a complete Java package? Sure, I could do this 
> with reflection (iterate over each class in a given package and assign 
> alias), but this is not very nifty ;-)
> 
>    -Tom
> 
> Am 12.03.2010 um 22:35 schrieb Igor Vaynberg:
> 
> > see sharedresources#putclassalias
> > 
> > -igor
> > 
> > On Fri, Mar 12, 2010 at 1:23 PM, Thomas Götz <[email protected]> wrote:
> >> Is there a way to have prettier URLs when including images that are 
> >> referenced with a ResourceReference?
> >> When I add an image like that:
> >> 
> >> Image image = new Image("image", new 
> >> ResourceReference(some.package.name.and.Class.class, "my_image.gif"));
> >> add(image);
> >> 
> >> ... this results in a rather technical URL 
> >> ("resources/some.package.name.and.Class/my_image.gif"), and I'd also 
> >> prefer that my internal package structure is not visible to the rest of 
> >> the world.
> >> 
> >> Can this be somewhat prettier maybe? ;-)
> >> 
> >> Thanks,
> >>   -Tom
> >> 
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >> 
> >> 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to