Using non-shared images? My problem is that I need same url for href in <a> and for src in <img> for lightbox to work.
> -----Original Message----- > From: Dan Retzlaff [mailto:[email protected]] > Sent: Friday, 05. August 2011 18:45 > To: [email protected] > Subject: Re: tomcat eats memory > > This is your problem: > > Start.get().getSharedResources().add("image" + > > random.toString() + ".jpg", image); > > > Adding shared resources during page construction is very > unusual. Consider registering shared resources in > Application.init(), or using non-shared images. Refer to > http://wicketstuff.org/wicket/images/ > > On Fri, Aug 5, 2011 at 9:20 AM, Miroslav F. <[email protected]> wrote: > > > Hi folks, > > > > I have these classes: > > > > package com.myapp; > > public class Minerals extends WebPage{ > > public Minerals(){ > > RepeatingView repeater = new > RepeatingView("repeater"); > > //data from database - images and descriptions > > ArrayList dataFromDB = (new ImagesMinerals()).load(); > > //descriptions > > ArrayList desc = new ArrayList(); > > desc = (ArrayList) dataFromDB.get(0); > > //images > > ArrayList images = new ArrayList(); > > images = (ArrayList) dataFromDB.get(1); > > int size = images.size(); > > for(int i = 0; i < size; i++){ > > String repeaterID = repeater.newChildId(); > > ImageRepeater repeaterChild = new > > ImageRepeater(repeaterID); > > //add description > > repeaterChild.add(new Label("description", > > (String) desc.get(i))); > > //add image > > DBImage image = new DBImage(); > > image.setImageData((byte[]) images.get(i)); > > //not caching on browser > > Double random = Math.random(); > > //put shared resource (image) on clean path > > > Start.get().getSharedResources().add("image" + > > random.toString() + ".jpg", image); > > ResourceReference imageResource = new > > ResourceReference("image" + random.toString() + ".jpg"); > > String url = > > RequestCycle.get().urlFor(imageResource).toString(); > > //href in <a> and src in <img> > should have same > > path because lightbox won't work... > > ExternalLink odkaz = new > ExternalLink("anchor", > > url); > > WebMarkupContainer imageSrcAttribute = new > > WebMarkupContainer("image"); > > imageSrcAttribute.add(new > > AttributeModifier("src", new Model<String>(url))); > > odkaz.add(imageSrcAttribute); > > odkaz.add(new > SimpleAttributeModifier("title", > > (String) desc.get(i))); > > repeaterChild.add(odkaz); > > repeater.add(repeaterChild); > > } > > this.add(repeater); > > } > > } > > > > package com.myapp; > > public class ImagesMinerals extends > > LoadableDetachableModel<ArrayList<byte[]>>{ > > @Override > > protected ArrayList load(){ > > DBGetImages databaseMinerals = new DBGetImages(); > > ArrayList dataMineraly = databaseMinerals.getData(); > > return dataMinerals; > > } > > } > > > > My problem is that when i again and again click on page the > memory in > > tomcat is eaten and I end-up with Java heap space error. Doesn't > > matter if heap is 64MB or 1GB on start, after some clicks memory is > > eaten. > > > > Somethink wrong with my LDM? > > > > Miro > > > > > > > --------------------------------------------------------------------- > > 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]
