HI,

On Wed, Dec 14, 2011 at 7:59 PM, Bertrand Guay-Paquet
<ber...@step.polymtl.ca> wrote:
> Hi,
>
> I am using resource references for the first time to implement fetching
> images from a DB. The URLs will be of the following form:
> "/resources/dbImages/DB_ID.png" where DB_ID is an identifier to retrieve the
> image from the DB.
>
> I'm using the article at
> http://wicketinaction.com/2011/07/wicket-1-5-mounting-resources/ as a guide
> and have a couple of questions.
>
> 1. What is the purpose of the equals() override in the class ImageResource?
> I don't understand the explanation given in the article... Also, I put a
> breakpoint in my own resource class' equals() method and it never hits!

Until recently both ResRef's #equals() and IResource#equals() were
needed to find the mapped ResRef.
This was improved recently (1.5.3 or trunk, not sure) and now only
ResRef#equals() is used. See ResourceMapper#mapRequest().

>
> 2. Can I use part of the "resources" namespace or is that asking for trouble
> since Wicket can use it however it likes?

Use it. /resources/... is for 1.4.x
In 1.5 the special one is /wicket/resource/... See IMapperContext

>
> 3. When using getRequestCycle().urlFor(new MyResourceReference(),
> imageParameters), the following happens:
> at line 216 in ResourceMapper#addCachingDecoration(Url, PageParameters) :
>    final IResource resource = resourceReference.getResource();
>
> with a comment right above that says "// TODO is calling getResource() a
> potential performance bottleneck?"
>
> I am concerned that each time a url to my image resource reference is
> created, the DB will be hit, simply for getting the Url! It will then maybe
> be hit a second time afterwards if the client doesn't have the image in
> cache. Am I completely off-base here? Is there another way to manage
> resources so this doesn't happen?
>
> Thanks,
> Bertrand
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to