You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Thomas Götz <to...@richmountain.de> on 2010/03/12 22:23:36 UTC
Prettier URLs for ResourceReference images
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Prettier URLs for ResourceReference images
Posted by Thomas Götz <to...@richmountain.de>.
Thanks, you saved my day ;-)
-Tom
On 12.03.2010 at 22:35 Igor Vaynberg wrote:
> see sharedresources#putclassalias
>
> -igor
>
> On Fri, Mar 12, 2010 at 1:23 PM, Thomas Götz <to...@richmountain.de> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Prettier URLs for ResourceReference images
Posted by Thomas Götz <to...@richmountain.de>.
Ok, this is sexy, thanks for pointing me into the right direction ;-)
-Tom
Am 13.03.2010 um 12:08 schrieb Martin Grigorov:
> 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 <to...@richmountain.de> 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: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Prettier URLs for ResourceReference images
Posted by Martin Grigorov <mc...@e-card.bg>.
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 <to...@richmountain.de> 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: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Prettier URLs for ResourceReference images
Posted by Thomas Götz <to...@richmountain.de>.
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 <to...@richmountain.de> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Prettier URLs for ResourceReference images
Posted by Igor Vaynberg <ig...@gmail.com>.
see sharedresources#putclassalias
-igor
On Fri, Mar 12, 2010 at 1:23 PM, Thomas Götz <to...@richmountain.de> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org