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();
}
Aggregations