Hi, Please file a ticket at https://issues.apache.org/jira/browse/WICKET and we will improve it. As a workaround you can override #getVariation() for the pages and return "html" and "fo" respectively.
Martin Grigorov Wicket Training and Consulting On Tue, May 6, 2014 at 11:39 AM, Fabio Fioretti <[email protected] > wrote: > Hi all, > > I have a Wicket 6 application that integrates with Apache FOP in a way > that, by overriding Page's getMarkupType(), I can have a component render > its .fo markup (to generate a PDF) instead of the usual html, depending on > whether it is added to a Page with the fo MarkupType or the standard html > one. > > This means my typical Panel has two markup files, an html one and a fo one: > Panel.fo and Panel.html. > > Now, the default CashingResourceStreamLocator makes use of > ResourceReference#Key for the cache. That Key completely ignores the > extension of the file or, better, assumes it is part of the name, while for > markup files this is apparently not the case. Basically, Panel.html and > Panel.fo have the same Key, the name of which is simply "Panel". > > Therefore, when a Panel is first rendered in html, its html markup > reference is cached and there is no way to make it render again in fo, > because the cache will always return the html markup reference. > > The solution is not dramatic but makes me feel uncomfortable: I had to > write a custom CashingResourceStreamLocator clone, using a custom Key that > is basically a ResourceReference#Key with an added "extension" property. > > What am I missing here? > > Thanks very much for you help and keep up the excellent work, > Fabio Fioretti >
