public static void preventCache ( ServletResponse response ) { if ( response instanceof HttpServletResponse ) { HttpServletResponse httpResponse = ( HttpServletResponse ) response ; httpResponse . setHeader ( "Pragma" , "No-cache" ) ; httpResponse . setHeader ( "Cache-Control" , "no-cache,no-store,max-age=0" ) ; httpResponse . setDateHeader ( "Expires" , 1 ) ; } }
Set response headers to prevent caching of the response by the browser .