Hi, I think it should work with different instances too when #equals() is implemented. Please create a quickstart and attach it to JIRA. Thanks!
Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Jun 14, 2016 at 12:21 PM, Davids Patrick <p.dav...@healthag.de> wrote: > Hi Martin, > some news... > > It is working when I keep a (java-code-)reference to the Resource instance > in my ResourceReference. > So, I always returning the same instance when wicket calls > ResourceReference#getResource(). > > But, this is not the way it should be, right? > > kind regards > Patrick > > -----Ursprüngliche Nachricht----- > Von: Davids Patrick > Gesendet: Freitag, 10. Juni 2016 10:08 > An: 'users@wicket.apache.org' > Betreff: AW: Conditional (static) dynamic resources / ;-) > > Hi Martin, > ok... working... but not as expected. > > My urls are stable and cachable. > > But I dont know, what I do wrong. > According to the blog article... > > I did mount my ResourceReference. > The ResourceReference returns an instance of Resource which loads my image. > I did override equals() of Resource to let wicket determine the correct > instance. > > But... the code never runs through equals(). > I always get an new Resource instance (getResource() of the > ResourceReference is called multiple times) Due to that, my lastModified > date flags I set in the Resource are (still) lost. > > So the browser is now able to cache, because the urls are stable, but the > expire dates in request header forces the browser to load the image again. > > It seems the ResourceReferenceRegistry is not working correct... somehow... > > kind regards > Patrick > > -----Ursprüngliche Nachricht----- > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > Gesendet: Donnerstag, 9. Juni 2016 15:14 > An: users@wicket.apache.org > Betreff: Re: Conditional (static) dynamic resources / ;-) > > See org.apache.wicket.markup.html.image.Image#Image(java.lang.String, > org.apache.wicket.request.resource.ResourceReference, > org.apache.wicket.request.mapper.parameter.PageParameters, > org.apache.wicket.request.resource.ResourceReference...) > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Thu, Jun 9, 2016 at 2:34 PM, Davids Patrick <p.dav...@healthag.de> > wrote: > > > Hi Martin, > > but how do I put the particular parameter into the Image src which > > makes it static? > > I'm not able to manually call > > > > getRequestCycle().urlFor(imagesResourceReference, imageParameters); > > > > What I do is add(new Image, new > > PersonImageResourceReference(personInstance)); > > > > How can I provide a parameter personNumer=1234 > > (personInstance.getNumber()) to the url the Image create for its own > > src attribute? > > > > Best regards > > Patrick > > > > -----Ursprüngliche Nachricht----- > > Von: Martin Grigorov [mailto:mgrigo...@apache.org] > > Gesendet: Dienstag, 7. Juni 2016 17:05 > > An: users@wicket.apache.org > > Betreff: Re: Conditional (static) dynamic resources / ;-) > > > > Hi, > > > > I would use mounted resource reference that serves the images. > > Check wicketinaction.com. There is a blog article explaining how to do > it. > > > > Martin Grigorov > > Wicket Training and Consulting > > https://twitter.com/mtgrigorov > > > > On Tue, Jun 7, 2016 at 4:57 PM, Davids Patrick <p.dav...@healthag.de> > > wrote: > > > > > Hi all, > > > I have a quite tricky usecase here and I don't know how to handle that. > > > > > > Our system allows to upload user pictures to profiles. > > > So, when the user profile picture is displayed it is read from > > > database and delivered by DynamicImageResource. > > > > > > If the user did not upload any pictures yet an fallback image is > > > delivered (generic male and female). > > > > > > To have them cached/static I thought I can handle this by setting > > > the lastModified flag, but in my case I revoke the behavior, because > > > I am in a refreshing view which re-creates my components, due to > > > that also a new DynamicImageResource is created and my lastModified > > > date information is lost. > > > > > > What could be the best practice to achieve a "conditional caching" > > > for (Dynamic)ImageResources? > > > > > > Kind regards > > > Patrick > > > > > > -------------------------------------------------------------------- > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > >