Search in sources :

Example 6 with UrlBuilder

use of com.google.gwt.http.client.UrlBuilder in project gerrit by GerritCodeReview.

the class Gerrit method getUiSwitcherUrl.

private static String getUiSwitcherUrl(String token) {
    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));
    }
    String[] tokens = token.split("@", 2);
    if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) {
        tokens[0] = tokens[0].substring(1);
    }
    builder.setPath(Location.getPath() + tokens[0]);
    if (tokens.length == 2) {
        builder.setHash(tokens[1]);
    }
    builder.setParameter("polygerrit", "1");
    return builder.buildString();
}
Also used : UrlBuilder(com.google.gwt.http.client.UrlBuilder)

Aggregations

UrlBuilder (com.google.gwt.http.client.UrlBuilder)6 LinkMenuItem (com.google.gerrit.client.ui.LinkMenuItem)1 ProjectLinkMenuItem (com.google.gerrit.client.ui.ProjectLinkMenuItem)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 JSONString (com.google.gwt.json.client.JSONString)1 Storage (com.google.gwt.storage.client.Storage)1 Confirm (cz.metacentrum.perun.webgui.widgets.Confirm)1 NewWindowOptions (org.rstudio.studio.client.common.GlobalDisplay.NewWindowOptions)1