Adds ServiceDefTarget.getSerializationPolicyName().  This allows
browser code to query the RPC policy name it will be using
for a particular RPC service.

Review by: bobv


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@7239 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/rpc/client/impl/RpcServiceProxy.java b/user/src/com/google/gwt/rpc/client/impl/RpcServiceProxy.java
index 694e968..e68d17c 100644
--- a/user/src/com/google/gwt/rpc/client/impl/RpcServiceProxy.java
+++ b/user/src/com/google/gwt/rpc/client/impl/RpcServiceProxy.java
@@ -31,7 +31,7 @@
 
   protected RpcServiceProxy(String moduleBaseURL,
       String remoteServiceRelativePath, TypeOverrides typeOverrides) {
-    super(moduleBaseURL, remoteServiceRelativePath, null, null);
+    super(moduleBaseURL, remoteServiceRelativePath, "(unused)", null);
     this.typeOverrides = typeOverrides;
   }
 
diff --git a/user/src/com/google/gwt/user/client/rpc/ServiceDefTarget.java b/user/src/com/google/gwt/user/client/rpc/ServiceDefTarget.java
index b2084e6..b435527 100644
--- a/user/src/com/google/gwt/user/client/rpc/ServiceDefTarget.java
+++ b/user/src/com/google/gwt/user/client/rpc/ServiceDefTarget.java
@@ -34,6 +34,12 @@
       super("Service implementation URL not specified");
     }
   }
+  
+  /**
+   * Return the strong name of the serialization policy to be used with this RPC
+   * instance.
+   */
+  String getSerializationPolicyName();
 
   /**
    * Gets the URL of a service implementation.
diff --git a/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java b/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
index 793f63f..1167b55 100644
--- a/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
+++ b/user/src/com/google/gwt/user/client/rpc/impl/RemoteServiceProxy.java
@@ -212,6 +212,10 @@
     clientSerializationStreamWriter.prepareToWrite();
     return clientSerializationStreamWriter;
   }
+  
+  public String getSerializationPolicyName() {
+    return serializationPolicyName;
+  }
 
   /**
    * @see ServiceDefTarget#getServiceEntryPoint()
diff --git a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
index 7f892ac..6420b6b 100644
--- a/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
+++ b/user/test/com/google/gwt/user/client/rpc/RemoteServiceServletTest.java
@@ -231,6 +231,15 @@
   }
 
   /**
+   * Test that the policy strong name is available from browser-side Java code.
+   */
+  public void testPolicyStrongName() {
+    String policy = ((ServiceDefTarget) getAsyncService()).getSerializationPolicyName();
+    assertNotNull(policy);
+    assertTrue(!policy.isEmpty());
+  }
+
+  /**
    * Verify behavior when the RPC method throws an unknown RuntimeException
    * (possibly one unknown to the client).
    */