Package com.google.gwt.http.client

Examples of com.google.gwt.http.client.UrlBuilder


        public void execute(CommandResponse response) {
          if (response instanceof ExportToCsvResponse) {
            ExportToCsvResponse resp = (ExportToCsvResponse) response;
            if (resp.getDocumentId() != null) {
              UrlBuilder ub = new UrlBuilder();
              ub.setPath("d/csvDownload");
              ub.setParameter("id", resp.getDocumentId());
              String link = ub.buildString().replaceFirst("http:///", GWT.getHostPageBaseURL());

              Window window = new DockableWindow();
              window.setTitle(messages.exportToCsvWindowTitle());
              String content = CONTENT_PRE + messages.exportToCsvContentReady() + CONTENT_POST;
              String linktocsv = messages.exportToCsvDownloadLink(link) + LINK_POST;
View Full Code Here


  // Private methods:
  // -------------------------------------------------------------------------

  /** Build the correct URL for the new locale. */
  private String buildLocaleUrl(String selectedLocale) {
    UrlBuilder builder = Window.Location.createUrlBuilder();
    builder.removeParameter("locale");
    if (!"default".equals(selectedLocale)) {
      builder.setParameter("locale", selectedLocale);
    }
    return builder.buildString();
  }
View Full Code Here

                return 0;
            }
        }

        private void setDevMode(int mode) {
            UrlBuilder u = Location.createUrlBuilder();
            switch (mode) {
            case 2:
                u.setParameter("superdevmode", "");
                u.removeParameter("gwt.codesvr");
                break;
            case 1:
                u.setParameter("gwt.codesvr", "localhost:9997");
                u.removeParameter("superdevmode");
                break;
            default:
                u.removeParameter("gwt.codesvr");
                u.removeParameter("superdevmode");
            }
            Location.assign(u.buildString());
        }
View Full Code Here

        removeSession(getSuperDevModeHookKey());
        redirect(false);
    }

    protected static void redirect(boolean devModeOn) {
        UrlBuilder createUrlBuilder = Location.createUrlBuilder();
        if (!devModeOn) {
            createUrlBuilder.removeParameter("superdevmode");
        } else {
            createUrlBuilder.setParameter("superdevmode", "");
        }

        Location.assign(createUrlBuilder.buildString());

    }
View Full Code Here

     * Create a {@link UrlBuilder} based on this {@link Location}.
     *
     * @return the new builder
     */
    public static UrlBuilder createUrlBuilder() {
      UrlBuilder builder = new UrlBuilder();
      builder.setProtocol(getProtocol());
      builder.setHost(getHost());
      String path = getPath();
      if (path != null && path.length() > 0) {
        builder.setPath(path);
      }
      String hash = getHash();
      if (hash != null && hash.length() > 0) {
        builder.setHash(hash);
      }
      String port = getPort();
      if (port != null && port.length() > 0) {
        builder.setPort(Integer.parseInt(port));
      }

      // Add query parameters.
      Map<String, List<String>> params = getParameterMap();
      for (Map.Entry<String, List<String>> entry : params.entrySet()) {
        List<String> values = new ArrayList<String>(entry.getValue());
        builder.setParameter(entry.getKey(),
            values.toArray(new String[values.size()]));
      }

      return builder;
    }
View Full Code Here

    }
    EventDispatcherPanel.of(select).registerChangeHandler(null, new WaveChangeHandler() {

      @Override
      public boolean onChange(ChangeEvent event, Element context) {
        UrlBuilder builder = Location.createUrlBuilder().setParameter(
                "locale", select.getValue());
        Window.Location.replace(builder.buildString());
        localeService.storeLocale(select.getValue());
        return true;
      }
    });
  }
View Full Code Here

     * Create a {@link UrlBuilder} based on this {@link Location}.
     *
     * @return the new builder
     */
    public static UrlBuilder createUrlBuilder() {
      UrlBuilder builder = new UrlBuilder();
      builder.setProtocol(getProtocol());
      builder.setHost(getHost());
      String path = getPath();
      if (path != null && path.length() > 0) {
        builder.setPath(path);
      }
      String hash = getHash();
      if (hash != null && hash.length() > 0) {
        builder.setHash(hash);
      }
      String port = getPort();
      if (port != null && port.length() > 0) {
        builder.setPort(Integer.parseInt(port));
      }

      // Add query parameters.
      Map<String, List<String>> params = getParameterMap();
      for (Map.Entry<String, List<String>> entry : params.entrySet()) {
        List<String> values = new ArrayList<String>(entry.getValue());
        builder.setParameter(entry.getKey(),
            values.toArray(new String[values.size()]));
      }

      return builder;
    }
View Full Code Here

       * the same path suffix (e.g., '/junit.html') as the current URL.
       */
      String currentPath = Window.Location.getPath();
      String pathSuffix = currentPath.substring(currentPath.lastIndexOf('/'));
     
      UrlBuilder builder = Window.Location.createUrlBuilder();
      builder.setParameter(BLOCKINDEX_QUERY_PARAM,
          Integer.toString(currentBlock.getIndex())).setPath(
          newModule + pathSuffix);
      Window.Location.replace(builder.buildString());
      currentBlock = null;
      currentTestIndex = 0;
    }
  }
View Full Code Here

  }

  @Override
  public void replaceState(String data, String title, String url) {
    UrlBuilder builder = Window.Location.createUrlBuilder();
    builder.setHash(data);
    Window.Location.replace(builder.buildString());

  }
View Full Code Here

          }
        });
        bus.addHandler(LocaleChangeEvent.TYPE, new LocaleChangeEventHandler() {
          @Override
          public void onLocaleChangeEvent(LocaleChangeEvent event) {
            UrlBuilder builder = Location.createUrlBuilder().setParameter("locale", event.getLocale());
            Window.Location.replace(builder.buildString());
          }
        });
      }

      @Override
View Full Code Here

TOP

Related Classes of com.google.gwt.http.client.UrlBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.