Set no-cache headers for nearly all Super Dev Mode pages

This is necessary for IE9 and IE10 (at least).

Change-Id: Ib8ca44580349666079b1c461c55a7c1bd331b8ed
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/PageUtil.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/PageUtil.java
index 74f0e2e..47f652c 100644
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/PageUtil.java
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/PageUtil.java
@@ -31,6 +31,7 @@
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 import java.net.URL;
+import java.util.Date;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
@@ -42,6 +43,8 @@
  */
 class PageUtil {
 
+  private static final String TIME_IN_THE_PAST = "Fri, 01 Jan 1990 00:00:00 GMT";
+
   /**
    * Sends a page represented as a string.
    */
@@ -53,6 +56,16 @@
   }
 
   /**
+   * Sets all headers that might help to prevent a page from being cached.
+   */
+  static void setNoCacheHeaders(HttpServletResponse response) {
+    response.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
+    response.setHeader("Pragma", "no-cache");
+    response.setHeader("Expires", TIME_IN_THE_PAST);
+    response.setDateHeader("Date", new Date().getTime());
+  }
+
+  /**
    * Sends an HTML page with some JSON code prepended to it.
    *
    * @param variableName  the name of the variable to set on the "window" object.
diff --git a/dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java b/dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java
index 6699312..a1cd01c 100644
--- a/dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java
+++ b/dev/codeserver/java/com/google/gwt/dev/codeserver/WebServer.java
@@ -37,7 +37,6 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
-import java.util.Date;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.Map;
@@ -85,7 +84,6 @@
       Pattern.compile("([a-zA-Z_][a-zA-Z0-9_]*\\.)*[a-zA-Z_][a-zA-Z0-9_]*");
 
   private static final MimeTypes MIME_TYPES = new MimeTypes();
-  private static final String TIME_IN_THE_PAST = "Fri, 01 Jan 1990 00:00:00 GMT";
 
   private final SourceHandler handler;
 
@@ -163,6 +161,13 @@
 
   private void doGet(String target, HttpServletRequest request, HttpServletResponse response)
       throws IOException {
+
+    if (!target.endsWith(".cache.js")) {
+      // Make sure IE9 doesn't cache any pages.
+      // (Nearly all pages may change on server restart.)
+      PageUtil.setNoCacheHeaders(response);
+    }
+
     if (target.equals("/")) {
       setHandled(request);
       JsonObject config = makeConfig();
@@ -288,11 +293,6 @@
 
     if (target.endsWith(".cache.js")) {
       response.setHeader("X-SourceMap", sourceMapLocationForModule(moduleName));
-    } else if (target.endsWith(".nocache.js")) {
-      response.setHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");
-      response.setHeader("Pragma", "no-cache");
-      response.setHeader("Expires", TIME_IN_THE_PAST);
-      response.setDateHeader("Date", new Date().getTime());
     }
     response.setHeader("Access-Control-Allow-Origin", "*");
     String mimeType = guessMimeType(target);