I use a servlet filter to tell the browser not to cache the nocache files:

public class ServletFilter implements Filter {
  private static final String NO_CACHE = ".nocache.js";

  @Override
  public void doFilter(ServletRequest request, ServletResponse response, 
FilterChain 
chain) throws IOException, ServletException {
    String requestURI = ((HttpServletRequest)request).getRequestURI();

    // Don't cache the nocache
    if (requestURI.endsWith(NO_CACHE)) {
      setNoCache((HttpServletResponse)response);
    }
    chain.doFilter(request, response);
  }

  private void setNoCache(HttpServletResponse httpResponse) {
    Date now = new Date();
    httpResponse.setDateHeader("Date", now.getTime());
    httpResponse.setDateHeader("Expires", now.getTime() - 86400000L);
    httpResponse.setHeader("Pragma", "no-cache");
    httpResponse.setHeader("cache-control", "public, max-age=0, 
must-revalidate");
  }
}

On Saturday 13 January 2024 at 2:54:08 am UTC+11 Jeff Hill wrote:

> There may have been some Chrome updates in the last few months; 
> occasionally, I must hard refresh to get the latest code from nocache.js.  
> (That did not happen in  years past)
>
> Anyway, I always check in Developer Tools in Chrome to make sure there are 
> no errors in the "Console" and all the necessary files are being loaded in 
> the "Network" tab.
> On Thursday, January 11, 2024 at 6:42:14 AM UTC-7 Frank Hossfeld wrote:
>
>> Check if the nochache.js gets loaded at a applicaiton staert or if it got 
>> a 404. In this case something with the URI is not ok.
>>
>> Antonio Capone schrieb am Donnerstag, 11. Januar 2024 um 10:56:55 UTC+1:
>>
>>> Hi all. I deployed an app using GWT on Cloud. It's deployed and working, 
>>> but when you log in, the browser window just says "Loading" and seems to 
>>> hang indefinitely. Works fine locally in Eclipse.
>>> Has this ever happened to you? Is there anyone who can help me 
>>> understand why this happens?
>>> Many thanks
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/76e39f7a-8df0-4a7d-9d81-e14467b3764an%40googlegroups.com.

Reply via email to