Examples of URLBuilder


Examples of com.brewtab.ircbot.util.URLBuilder

        }

        String tags = sb.toString();

        try {
            URLBuilder urlBuilder = new URLBuilder(baseURL);
            urlBuilder.setParameter("s", Joiner.on(' ').join(symbols));
            urlBuilder.setParameter("f", tags);

            log.info("Stock request: {}", urlBuilder.toString());

            InputStream s = urlBuilder.toUrl().openStream();
            ByteArrayOutputStream data = new ByteArrayOutputStream();
            byte[] buff = new byte[1024];

            while (true) {
                int n = s.read(buff);
View Full Code Here

Examples of com.google.api.explorer.client.routing.UrlBuilder

   * URL, given the method name and method definition returned by
   * {@link #getMethodForUrl(ApiService, String)}.
   */
  @VisibleForTesting
  static String createExplorerLink(ApiService service, String url, ApiMethod method) {
    UrlBuilder builder = new UrlBuilder();

    // Add the basic information to the
    builder.addRootNavigationItem(RootNavigationItem.ALL_VERSIONS)
        .addService(service.getName(), service.getVersion())
        .addMethodName(method.getId());

    // Calculate the params from the path template and url.
    URLFragment parsed = URLFragment.parseFragment(url);
    Multimap<String, String> params = HashMultimap.create();
    String pathTemplate = method.getPath();
    if (pathTemplate.contains("{")) {
      String urlPath = parsed.getPath().replaceFirst(Config.getBaseUrl() + service.basePath(), "");
      String[] templateSections = pathTemplate.split("/");
      String[] urlSections = urlPath.split("/");
      for (int i = 0; i < templateSections.length; i++) {
        if (templateSections[i].contains("{")) {
          String paramName = templateSections[i].substring(1, templateSections[i].length() - 1);
          params.put(paramName, urlSections[i]);
        }
      }
    }

    // Apply the params.
    String fullUrl = builder.addQueryParams(params).toString();

    // Check if the url had query parameters to add.
    if (!parsed.getQueryString().isEmpty()) {
      fullUrl = fullUrl + parsed.getQueryString();
    }
View Full Code Here

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

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

  // 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

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

                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

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

        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

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

     * 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

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

    }
    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

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

     * 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

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

       * 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
TOP
Copyright © 2018 www.massapi.com. 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.