Author: echatellier Date: 2013-02-25 17:22:06 +0100 (Mon, 25 Feb 2013) New Revision: 158 Url: http://forge.codelutin.com/projects/cantharella/repository/revisions/158 Log: Disable image cache. Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/DocumentLinkPanel.java Modified: trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/DocumentLinkPanel.java =================================================================== --- trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/DocumentLinkPanel.java 2013-02-25 16:01:45 UTC (rev 157) +++ trunk/cantharella.web/src/main/java/nc/ird/cantharella/web/pages/domain/document/panel/DocumentLinkPanel.java 2013-02-25 16:22:06 UTC (rev 158) @@ -11,6 +11,7 @@ import org.apache.wicket.model.IModel; import org.apache.wicket.request.resource.ByteArrayResource; import org.apache.wicket.request.resource.ContextRelativeResource; +import org.apache.wicket.util.time.Duration; /** * Panel which include a linkable image. Used with the LinkableImagePropertyColumn$LinkablePanel.html file @@ -30,13 +31,28 @@ .getFileMimetype(), document.getFileContent())); add(link); + // les images ne doivent pas être mise en cache car les liens + // étant défini sur les cellules des tableaux, lors + // de la suppression, les index sont changés et les images + // supprimées sont retrouvées par leurs lien dans le cache + // navigateur WebComponent img; if (ArrayUtils.isNotEmpty(document.getFileContentThumb())) { link.add(new AttributeModifier("class", "colorbox")); link.add(new AttributeModifier("title", document.getFileName())); - img = new Image("image", new ByteArrayResource("image/png", document.getFileContentThumb())); + img = new Image("image", new ByteArrayResource("image/png", document.getFileContentThumb()) { + @Override + protected void configureResponse(ResourceResponse response, Attributes attributes) { + response.setCacheDuration(Duration.NONE); + } + }); } else { - img = new Image("image", new ContextRelativeResource("images/download.png")); + img = new Image("image", new ContextRelativeResource("images/download.png") { + @Override + public boolean isCachingEnabled() { + return false; + } + }); } img.add(new AttributeModifier("title", document.getFileName())); link.add(img);