Change RemoteServiceServlet so gwt.codeserver.port works with more subclasses.

In many subclasses of RemoteServiceServlet, the doGetSerializationPolicy()
method is overridden so that it doesn't call super. As a result, setting
gwt.codeserver.port has no effect. To avoid this, I moved the calling code
into getSerializationPolicy(), which is a final method.

A subclass can still disable fetching serialization policies from
the code server by overriding getCodeServerPolicyUrl() to return 0,
but this won't happen by accident.

Change-Id: Ib47db371b78eabb1a139948744279b36aa306bc1
Review-Link: https://gwt-review.googlesource.com/#/c/2360/

Review by: mdempsky@google.com

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11576 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java b/user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java
index f8bae81..5645a0e 100644
--- a/user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java
+++ b/user/src/com/google/gwt/user/server/rpc/RemoteServiceServlet.java
@@ -206,6 +206,14 @@
     serializationPolicy = doGetSerializationPolicy(getThreadLocalRequest(),
         moduleBaseURL, strongName);
 
+    // Try SuperDevMode, if configured.
+    if (serializationPolicy == null) {
+      String url = getCodeServerPolicyUrl(strongName);
+      if (url != null) {
+        serializationPolicy = loadPolicyFromCodeServer(url);
+      }
+    }
+
     if (serializationPolicy == null) {
       // Failed to get the requested serialization policy; use the default
       log(
@@ -329,10 +337,8 @@
    * will only be called once for each combination of moduleBaseURL and strongName.</p>
    *
    * <p>The default implementation loads serialization policies stored as servlet resources
-   * in the same ServletContext as this servlet. If no policy is found or there's an error,
-   * it then attempts to load the policy from the URL returned by
-   * {@link #getCodeServerPolicyUrl}.
-   * 
+   * in the same ServletContext as this servlet.
+   *
    * <p>Override this method to load the {@link SerializationPolicy} using an
    * alternative approach.
    * 
@@ -343,19 +349,7 @@
    */
   protected SerializationPolicy doGetSerializationPolicy(
       HttpServletRequest request, String moduleBaseURL, String strongName) {
-
-    SerializationPolicy policy =
-        RemoteServiceServlet.loadSerializationPolicy(this, request, moduleBaseURL, strongName);
-    if (policy != null) {
-      return policy;
-    }
-
-    String url = getCodeServerPolicyUrl(strongName);
-    if (url != null) {
-      return loadPolicyFromCodeServer(url);
-    }
-
-    return null;
+    return RemoteServiceServlet.loadSerializationPolicy(this, request, moduleBaseURL, strongName);
   }
 
   /**