Skip to main content

I don't want to prevent files from being cached in debug

  4 posts   Feedicon  
Replies: 3 - Last Post: November 06, 2013 11:18
by: bluehat
showing 1 - 4 of 4
Posted: October 24, 2013 17:00 by tiagoperes
Jawr forces a "?d=timestamp" in the end of every js and css URL while i'm in debug mode. According to the documentation, it assures I'll always get the newest file. It's true, but I can also do it with ctrl+F5. The problem is, if the files are not cached, the brrowser always think it's a new file and it ruins javascript debug, each time I reload the page I lose all opened source codes (in dev tab) and worst: I lose all breakpoints. It's really annoying.

Is there any way, any option I can use to stop jawr from appending "d=timestamp" to my URLs?

Thanks in advance for any answer.
Posted: October 26, 2013 21:18 by icefox

Jawr allows you to disable the use of the random parameter in debug mode, in your tag, by using the useRandamParam attribute like below :

<jwr:script src="/myScript.js" useRandomParam="false" />

In the next version of Jawr (3.5), you will be able to set this properties at the application level by the following property in your jawr config file :


Posted: October 28, 2013 11:17 by tiagoperes
Thank you for answering! it solved my problem. It will be very nice to have a settable option in the next versions Smile
Posted: November 06, 2013 11:18 by bluehat
Can you also update JawrRequestHandler line 581 to force cache even in debug mode. Indeed, with Chrome, even if I disable RandomParam, the files are reloaded all the time.
580	// If debug mode is off, check for If-Modified-Since and If-none-match headers and set response caching headers.
581	if (!this.jawrConfig.isDebugModeOn()) {
582 	// If a browser checks for changes, always respond 'no changes'.
583 	if (validBundle && (null != request.getHeader(IF_MODIFIED_SINCE_HEADER) || null != request.getHeader(IF_NONE_MATCH_HEADER))) {
584 		response.setStatus(HttpServletResponse.SC_NOT_MODIFIED);
585 		if (LOGGER.isDebugEnabled())
586 			LOGGER.debug("Returning 'not modified' header. ");
587 		return;
588 		}
590 	if(validBundle){
591 		// Add caching headers
592 		setResponseHeaders(response);
593 	}else{
595 		writeResponseHeader = illegalBundleRequestHandler.writeResponseHeader(requestedPath, request, response);
596 		if(!writeResponseHeader){
597 			// Add caching headers
598 			setResponseHeaders(response);
599 		}
600 	}
601 }
Replies: 3 - Last Post: November 06, 2013 11:18
by: bluehat
Please Confirm