Package com.google.gwt.http.client

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


      History.fireCurrentHistoryState();
    }
  }

  private void updateLocale(final String locale) {
    UrlBuilder builder = Location.createUrlBuilder().setParameter("locale", locale);
    Window.Location.replace(builder.buildString());
  }
View Full Code Here


                        removeHMParameter();
                    }
                }

                private void addHMParameter() {
                    UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                    createUrlBuilder.setParameter("gwt.codesvr",
                            "localhost:9997");
                    Location.assign(createUrlBuilder.buildString());
                }

                private void removeHMParameter() {
                    UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                    createUrlBuilder.removeParameter("gwt.codesvr");
                    Location.assign(createUrlBuilder.buildString());

                }
            });

            autoScroll
View Full Code Here

                String windowLocationOrg = UtilsJS.getHostPageLocation() + "?locale=" + localeName;
                GenClient.showDebug("windowLocationOrg: " + windowLocationOrg);
                // http://google-web-toolkit.googlecode.com/svn/javadoc/2.2/com/google/gwt/user/client/Window.Location.html#createUrlBuilder()
                // exists but in a different version of the api?
                if ( true ) {
                    UrlBuilder builder = Location.createUrlBuilder().setParameter("locale", localeName);
                    String windowLocation = builder.buildString();
                    GenClient.showDebug("windowLocation: " + windowLocation);
                    Window.Location.replace(windowLocation);
                } else {
                    GenClient.showCodeBug("Check code here because JFD had to disable some vital code to keep Eclipse's code checker happy.");
                }
View Full Code Here

          Date expires = new Date();
          expires.setYear(expires.getYear() + 1);
          Cookies.setCookie(cookieName, localeName, expires);
        }
        if (queryParam != null) {
          UrlBuilder builder = Location.createUrlBuilder().setParameter(queryParam, localeName);
          Window.Location.replace(builder.buildString());
        } else {
          // If we are using only cookies, just reload
          Window.Location.reload();
        }
      }
View Full Code Here

        suffix = suffix.substring(1);
      }
      path += suffix;
    }

    UrlBuilder builder = new UrlBuilder();
    builder.setProtocol(Location.getProtocol());
    builder.setHost(Location.getHost());
    String port = Location.getPort();
    if (port != null && !port.isEmpty()) {
      builder.setPort(Integer.parseInt(port));
    }
    builder.setPath(path);
    return builder.buildString();
  }
View Full Code Here

                        removeHMParameter();
                    }
                }

                private void addHMParameter() {
                    UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                    createUrlBuilder.setParameter("gwt.codesvr",
                            "localhost:9997");
                    Location.assign(createUrlBuilder.buildString());
                }

                private void removeHMParameter() {
                    UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                    createUrlBuilder.removeParameter("gwt.codesvr");
                    Location.assign(createUrlBuilder.buildString());

                }
            });

            autoScroll
View Full Code Here

      String startup = ( (IFrameTabPanel) getContent() ).getUrl();
      if ( !StringUtils.isEmpty( ( (IFrameTabPanel) getContent() ).getDeepLinkUrl() ) ) {
        startup = ( (IFrameTabPanel) getContent() ).getDeepLinkUrl();
      }

      UrlBuilder builder = new UrlBuilder();
      builder.setProtocol( Window.Location.getProtocol() );
      builder.setHost( Window.Location.getHostName() );
      builder.setPort( Integer.parseInt( Window.Location.getPort() ) );
      builder.setPath( Window.Location.getPath() );
      //UrlBuilder will encode spaces as '+' which is a valid special character so we replace all spaces with '%20'
      builder.setParameter( "name", getLabelText().replaceAll( "\\s", "%20" ) );
      //the startup string is already encoded with ':' being replaced with '\t' and then encoded again...
      builder.setParameter( "startup-url", startup );

      final TextArea urlbox = new TextArea();
      //encode any space characters
      urlbox.setText( builder.buildString() );
      urlbox.setReadOnly( true );
      urlbox.setVisibleLines( 3 );
      dialogBox.setContent( urlbox );
      urlbox.setHeight( "80px" );
      urlbox.setWidth( "600px" );
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) {
        // Decode the hash now, because UrlBuilder.buildString() later encodes it.
        builder.setHash(URL.decodeQueryString(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

                                   int width,
                                   int height,
                                   NewWindowOptions options)
   {
      // build url
      UrlBuilder urlBuilder = Window.Location.createUrlBuilder();
      urlBuilder.setParameter("view", viewName);
     
      // setup options
      if (options == null)
         options = new NewWindowOptions();
      options.setName(SatelliteUtils.getSatelliteWindowName(viewName));
      options.setFocus(true);
     
      // open window (force web codepath b/c desktop needs this so
      // that window.opener is hooked up)
      webOpenMinimalWindow(globalDisplay,
                           urlBuilder.buildString(),
                           options,
                           width,
                           height,
                           false);
   }
View Full Code Here

  public void testLocationCreateUrlBuilder() {
    History.newItem("theHash");
    String expected = Location.getHref();

    // Build the string with the builder.
    UrlBuilder builder = Location.createUrlBuilder();
    String actual = builder.buildString();

    // Check the hash.
    {
      String[] expectedParts = expected.split("#");
      String[] actualParts = actual.split("#");
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.