How to prevent Grails from caching old versions of gsp file?

Emmett picture Emmett · Aug 30, 2009 · Viewed 10.2k times · Source

I am making modifications to /grails-app/views/index.gsp.

When I save the file and refresh http://localhost:8080/index.gsp in Firefox, I am getting an old version of the file.

Is there a way to prevent Grails from caching and rendering old versions of the file?

(I tried restarting the server and clearing Firefox's cache.)

Thanks!

Answer

VasiliyL picture VasiliyL · Jun 15, 2011

can't we use a filter like this?

class CacheFilters{

    def filters = {
        all(controller: '*', action: '*') {
            before = {
                ((HttpServletResponse) response).setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
            }
            after = {

            }
            afterView = {

            }
        }
    }

}