Example usage for com.google.gwt.http.client URL encodeQueryString

List of usage examples for com.google.gwt.http.client URL encodeQueryString

Introduction

In this page you can find the example usage for com.google.gwt.http.client URL encodeQueryString.

Prototype

public static String encodeQueryString(String decodedURLComponent) 

Source Link

Document

Returns a string where all characters that are not valid for a URL component have been escaped.

Usage

From source file:com.google.gerrit.client.admin.PaginatedProjectScreen.java

License:Apache License

protected String getTokenForScreen(String filter, int skip) {
    String token = getScreenToken();
    if (filter != null && !filter.isEmpty()) {
        token += "?filter=" + URL.encodeQueryString(filter);
    }/*from  w  w w . j  av a  2  s. c om*/
    if (skip > 0) {
        if (token.contains("?filter=")) {
            token += ",";
        } else {
            token += "?";
        }
        token += "skip=" + skip;
    }
    return token;
}

From source file:com.google.gerrit.client.admin.ProjectListScreen.java

License:Apache License

private void refresh() {
    setToken(subname == null || "".equals(subname) ? ADMIN_PROJECTS
            : ADMIN_PROJECTS + "?filter=" + URL.encodeQueryString(subname));
    ProjectMap.match(subname,/*from   w  ww  .j a  v a 2s.  co  m*/
            new IgnoreOutdatedFilterResultsCallbackWrapper<ProjectMap>(this, new GerritCallback<ProjectMap>() {
                @Override
                public void onSuccess(ProjectMap result) {
                    projects.display(result);
                }
            }));
}

From source file:com.google.gerrit.client.dashboards.DashboardList.java

License:Apache License

private static String encodeDashboardId(String id) {
    int c = id.indexOf(':');
    if (0 <= c) {
        String ref = URL.encodeQueryString(id.substring(0, c));
        String path = URL.encodeQueryString(id.substring(c + 1));
        return ref + ':' + path;
    }//  w  w w  . ja  v a 2 s  .  c  om
    return URL.encodeQueryString(id);
}

From source file:com.google.gerrit.client.Gerrit.java

License:Apache License

@Override
public void onModuleLoad() {
    UserAgent.assertNotInIFrame();//  ww  w  .j av  a  2 s.c  o m

    KeyUtil.setEncoderImpl(new KeyUtil.Encoder() {
        @Override
        public String encode(String e) {
            e = URL.encodeQueryString(e);
            e = fixPathImpl(e);
            e = fixColonImpl(e);
            e = fixDoubleQuote(e);
            return e;
        }

        @Override
        public String decode(final String e) {
            return URL.decodeQueryString(e);
        }

        private native String fixPathImpl(String path)
        /*-{ return path.replace(/%2F/g, "/"); }-*/;

        private native String fixColonImpl(String path)
        /*-{ return path.replace(/%3A/g, ":"); }-*/;

        private native String fixDoubleQuote(String path)
        /*-{ return path.replace(/%22/g, '"'); }-*/;
    });

    initHostname();
    Window.setTitle(M.windowTitle1(myHost));

    final HostPageDataService hpd = GWT.create(HostPageDataService.class);
    hpd.load(new GerritCallback<HostPageData>() {
        @Override
        public void onSuccess(final HostPageData result) {
            Document.get().getElementById("gerrit_hostpagedata").removeFromParent();
            myConfig = result.config;
            myTheme = result.theme;
            if (result.account != null) {
                myAccount = result.account;
                xGerritAuth = result.xGerritAuth;
            }
            if (result.accountDiffPref != null) {
                myAccountDiffPref = result.accountDiffPref;
                applyUserPreferences();
            }
            onModuleLoad2(result);
        }
    });
}

From source file:com.google.gerrit.client.GitwebLink.java

License:Apache License

private String encode(String segment) {
    return URL.encodeQueryString(type.replacePathSeparator(segment));
}

From source file:com.google.gerrit.client.info.GitwebInfo.java

License:Apache License

private final String encode(String segment) {
    if (type().urlEncode()) {
        return URL.encodeQueryString(type().replacePathSeparator(segment));
    } else {//from   www .  j  av  a2  s  .c  om
        return segment;
    }
}

From source file:com.google.gerrit.client.info.GroupInfo.java

License:Apache License

public final void setOwnerUUID(AccountGroup.UUID uuid) {
    owner_id(URL.encodeQueryString(uuid.get()));
}

From source file:com.google.gerrit.client.rpc.RestApi.java

License:Apache License

public RestApi id(String id) {
    return idRaw(URL.encodeQueryString(id));
}

From source file:com.google.gerrit.client.rpc.RestApi.java

License:Apache License

public RestApi addParameter(String name, String value) {
    return addParameterRaw(name, URL.encodeQueryString(value));
}

From source file:com.google.gwt.examples.http.client.QueryAndFormDataExample.java

public static String buildQueryString(Entry[] queryEntries) {
    StringBuffer sb = new StringBuffer();

    for (int i = 0, n = queryEntries.length; i < n; ++i) {
        Entry queryEntry = queryEntries[i];

        if (i > 0) {
            sb.append("&");
        }/* w ww. j  a  v a  2s  .c om*/

        // encode the characters in the name
        String encodedName = URL.encodeQueryString(queryEntry.getName());
        sb.append(encodedName);

        sb.append("=");

        // encode the characters in the value
        String encodedValue = URL.encodeQueryString(queryEntry.getValue());
        sb.append(encodedValue);
    }

    return sb.toString();
}