Note that there are some explanatory texts on larger screens.

plurals
  1. POJava/Wicket - How to stop browsers from caching pages?
    primarykey
    data
    text
    <p>I have a Java/Wicket page that generates a JNLP file that launches my company's software. This class will optionally take some url parameters and embed them as arguments in the JNLP. When the user launches this JNLP file the client application will perform some function based on those parameters. If the client software is already running on the machine, hitting the JNLP page will instead try to feed these parameters via a remote call to the running client instead of launching a new page.</p> <p>This part is where I'm having issues. On IE, Firefox and Chrome I could open a new client, but trying to hit the same URL again would instead return a JNLP file. I found that clearing the browser cache fixes this issue on all browsers. Also, I cannot seem to hit breakpoints in the JNLP class, which enforces my hunch that this is more of an issue with the request than something strange with Wicket.</p> <p>I put the following code in my page class, which extends <strong>org.apache.wicket.markup.html.WebPage</strong>:</p> <pre><code>@Override protected void setHeaders(WebResponse response) { getPageMap().remove(this); HttpServletResponse httpServletResponse = response.getHttpServletResponse(); if (httpServletResponse != null) { httpServletResponse.setDateHeader("Expires", 0); httpServletResponse.addHeader("Cache-Control", "no-cache,no-store,private,must-revalidate,max-stale=0,post-check=0,pre-check=0"); httpServletResponse.addHeader("Keep-Alive", "timeout=3, max=993"); } } </code></pre> <p>This doesn't seem to work, as Firefox 3.6 still seems to cache the result. IE 7 will work but only after trying the link I create a few times. I don't know a lot about web development and Wicket and this is new to me so it's possible I'm missing something simple.</p> <p>TL;DR: How do I get a Wicket page to not cache on the client browser?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload