Enunciate
  1. Enunciate
  2. ENUNCIATE-424

Dynamically discover the GWT URL instead of using the Enunciate deployment address

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.19
    • Fix Version/s: 1.20
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Existing implementation:

      /**
         * Utility class for getting an instance of the async interface for WelcomeService.
         */
        public static class Util {
      
          /**
           * Get an instance of this async interface for WelcomeService. This method assumes the endpoint is
           * mounted at "http://localhost:8080/GWTpubSub/gwt/welcome".
           *
           * @return The async instance.
           */
          public static WelcomeServiceAsync getInstance() {
            return getInstance("http://localhost:8080/GWTpubSub/gwt/welcome");
          }
      
          /**
           * Get an instance of this async interface for WelcomeService.
      
           *
           * @param url The url where the remote endpoint is mounted.
           * @return The async instance.
           */
          public static WelcomeServiceAsync getInstance(String url) {
            WelcomeServiceAsync asyncInstance = (WelcomeServiceAsync) com.google.gwt.core.client.GWT.create(WelcomeService.class);
      
            ((com.google.gwt.user.client.rpc.ServiceDefTarget) asyncInstance).setServiceEntryPoint(url);
            return asyncInstance;
          }
        }
      

      potential change:

      /**
         * Utility class for getting an instance of the async interface for WelcomeService.
         */
        public static class Util {
      
          /**
           * Get an instance of this async interface for WelcomeService. This method assumes the endpoint is
           * mounted at "http://localhost:8080/GWTpubSub/gwt/welcome".
           *
           * @return The async instance.
           */
          public static WelcomeServiceAsync getInstance() {
              /*
              ** Get URL for module
              */
              String url = com.google.gwt.core.client.GWT.getModuleBaseURL();
              /*
              ** Split off first part including server and port
              */
              String urlSplit[] = url.split("http://\\w+:\\d+/");
             /*
             ** Construct end point
             */
             return getInstance(urlSplit[0]+"/GWTpubSub/gwt/welcome");
          }
      
          /**
           * Get an instance of this async interface for WelcomeService.
      
           *
           * @param url The url where the remote endpoint is mounted.
           * @return The async instance.
           */
          public static WelcomeServiceAsync getInstance(String url) {
            WelcomeServiceAsync asyncInstance = (WelcomeServiceAsync) com.google.gwt.core.client.GWT.create(WelcomeService.class);
      
            ((com.google.gwt.user.client.rpc.ServiceDefTarget) asyncInstance).setServiceEntryPoint(url);
            return asyncInstance;
          }
        }
      

        Activity

        Hide
        Ryan Heaton added a comment -

        Change was to provide another method, getInstanceRelativeToUrl, where the relative URL can be passed in. Let the developer decide whether relative to GWT.getModuleBaseURL()

        Show
        Ryan Heaton added a comment - Change was to provide another method, getInstanceRelativeToUrl, where the relative URL can be passed in. Let the developer decide whether relative to GWT.getModuleBaseURL()
        Hide
        Ryan Heaton added a comment -

        closed for 1.20 release

        Show
        Ryan Heaton added a comment - closed for 1.20 release

          People

          • Assignee:
            Ryan Heaton
            Reporter:
            Ryan Heaton
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: