Reviewers: rjrjr,

Description:
Move RequestFactory.URL field into DefaultRequestTransport.
Patch by: bobv
Review by: rjrjr


Please review this at http://gwt-code-reviews.appspot.com/903801/show

Affected files:
  M doc/packages.properties
M user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java
  M user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java
  M user/src/com/google/gwt/requestfactory/shared/RequestFactory.java


Index: doc/packages.properties
===================================================================
--- doc/packages.properties     (revision 8821)
+++ doc/packages.properties     (working copy)
@@ -59,6 +59,7 @@
 com.google.gwt.view.client;\
 com.google.gwt.app.client;\
 com.google.gwt.app.place;\
+com.google.gwt.requestfactory.client;\
 com.google.gwt.requestfactory.server;\
 com.google.gwt.requestfactory.shared
 # The last package should not have a trailing semicolon
Index: user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java
===================================================================
--- user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java (revision 8821) +++ user/src/com/google/gwt/requestfactory/client/DefaultRequestTransport.java (working copy)
@@ -16,6 +16,7 @@
 package com.google.gwt.requestfactory.client;

import static com.google.gwt.user.client.rpc.RpcRequestBuilder.STRONG_NAME_HEADER;
+
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.shared.EventBus;
 import com.google.gwt.http.client.Request;
@@ -37,6 +38,14 @@
  * {...@link RequestBuilder}.
  */
 public class DefaultRequestTransport implements RequestTransport {
+
+  /**
+   * The default URL for a DefaultRequestTransport is
+ * <code>{...@link GWT#getHostPageBaseURL()} + {...@value #URL}</code> which may be
+   * overridden by calling {...@link #setRequestUrl(String)}.
+   */
+  public static final String URL = "gwtRequest";
+
   /*
    * A separate logger for wire activity, which does not get logged by the
* remote log handler, so we avoid infinite loops. All log messages that could
@@ -45,8 +54,9 @@
    */
private static Logger wireLogger = Logger.getLogger("WireActivityLogger");
   private static final String SERVER_ERROR = "Server Error";
+
   private final EventBus eventBus;
- private String requestUrl = GWT.getHostPageBaseURL() + RequestFactory.URL;
+  private String requestUrl = GWT.getHostPageBaseURL() + URL;

   /**
    * Construct a DefaultRequestTransport.
@@ -112,7 +122,8 @@
    * Creates a RequestCallback that maps the HTTP response onto the
    * {...@link TransportReceiver} interface.
    */
- protected RequestCallback createRequestCallback(final TransportReceiver receiver) {
+  protected RequestCallback createRequestCallback(
+      final TransportReceiver receiver) {
     return new RequestCallback() {

       public void onError(Request request, Throwable exception) {
Index: user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java
===================================================================
--- user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java (revision 8821) +++ user/src/com/google/gwt/requestfactory/server/SampleDataPopulator.java (working copy)
@@ -15,7 +15,7 @@
  */
 package com.google.gwt.requestfactory.server;

-import com.google.gwt.requestfactory.shared.RequestFactory;
+import com.google.gwt.requestfactory.client.DefaultRequestTransport;
 import com.google.gwt.requestfactory.shared.impl.RequestData;

 import org.apache.http.HttpEntity;
@@ -51,9 +51,9 @@
       System.exit(-1);
     }
     try {
-      if (!args[0].endsWith(RequestFactory.URL)) {
+      if (!args[0].endsWith(DefaultRequestTransport.URL)) {
         System.err.println("Please check your URL string " + args[0]
-            + ", it should end with " + RequestFactory.URL + ", exiting");
+ + ", it should end with " + DefaultRequestTransport.URL + ", exiting");
         System.exit(-1);
       }
SampleDataPopulator populator = new SampleDataPopulator(args[0], args[1]);
Index: user/src/com/google/gwt/requestfactory/shared/RequestFactory.java
===================================================================
--- user/src/com/google/gwt/requestfactory/shared/RequestFactory.java (revision 8821) +++ user/src/com/google/gwt/requestfactory/shared/RequestFactory.java (working copy)
@@ -27,9 +27,6 @@
  */
 public interface RequestFactory {
   String JSON_CONTENT_TYPE_UTF8 = "application/json; charset=utf-8";
-
-  // TODO: this must be configurable
-  String URL = "gwtRequest";

   <R extends EntityProxy> R create(Class<R> token);



--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to