Created https://issues.apache.org/jira/browse/WICKET-5838
Kind regards, Stijn Niclaes On Wed, Feb 18, 2015 at 2:24 PM, Martin Grigorov <[email protected]> wrote: > Please create a ticket in JIRA. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Wed, Feb 18, 2015 at 3:21 PM, Stijn Niclaes <[email protected]> > wrote: > > > As I understand it, getCacheKey() returning null results in no cache(at > > all), this is what we did before and probably what I will revert back to. > > But it's not really what I want: Ops complained about network traffic(no > > cache means every request fetches one of the basepages) and we got our > > drupal vendor to return the last-modified header, and keep it up-to-date, > > but now it seems wicket cannot get the value of the last-modified header > > because of the implementation in this Connections class. > > > > I wrote a unit-test that does the same as > Connections.getLastModified(final > > URL url) and the lastmodified value is always 0 when doInput is set to > > false. > > So I think this cache system with the last-modified header cannot work > for > > 'real' url's(remote markup) > > > > unit-test: > > @Test > > public void testLastModified() throws IOException { > > URL url = new URL("http://www….”); > > URLConnection connection = url.openConnection(); > > // connection.setDoInput(false); > > System.out.println(new DateTime(connection.getLastModified())); > > } > > > > point this to any url that returns a last-modified header and > > connection.getLastModified() returns this value. > > With setDoInput set to false, the url can even be non-existent, > > getLastModified returns 0. > > > > Kind regards, > > > > Stijn Niclaes > > > > > > On Wed, Feb 18, 2015 at 8:35 AM, Martin Grigorov <[email protected]> > > wrote: > > > > > Hi, > > > > > > The field is set to false because Wicket doesn't write anything to the > > > connection. It just reads from it. > > > > > > Reading the beginning of your message I thought that your base pages > need > > > to implement org.apache.wicket.markup.IMarkupCacheKeyProvider and > > override > > > #getCacheKey() to return null. Try it! > > > > > > > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > https://twitter.com/mtgrigorov > > > > > > On Tue, Feb 17, 2015 at 10:28 AM, Stijn Niclaes < > [email protected] > > > > > > wrote: > > > > > > > Hi all, > > > > > > > > We have 4 basePages for which the markup resides in a drupal > > > site(created a > > > > ResourceStreamLocator extension for that). All our other pages extend > > > from > > > > these. > > > > > > > > Now the problem is that these basePages get cached and the cache does > > not > > > > get invalidated. > > > > We get the up-to-date last-modified header from drupal but wicket > seems > > > to > > > > simply ignore it. > > > > > > > > Issue lies in Connections class: the static method > getLastModified(URL > > > url) > > > > creates a URLConnection, but then calls setDoInput(false) before > > calling > > > > connection.getLastModified(). > > > > URLConnection.getLastModified always returns 0 when doInput is set to > > > > false, no connection is even set up when doInput is false. > > > > > > > > Why is this doInput field set to false? > > > > > > > > We use Wicket 1.5.12. > > > > > > > > Kind regards, > > > > > > > > Stijn Niclaes > > > > > > > > > >
